mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-05 01:42:54 +01:00
fix: sign the aligned file instead of the input file
This commit is contained in:
parent
a0644c7045
commit
22d2535af8
@ -7,17 +7,18 @@ import java.io.File
|
|||||||
|
|
||||||
object Signing {
|
object Signing {
|
||||||
fun start(inputFile: File, outputFile: File, cn: String, password: String) {
|
fun start(inputFile: File, outputFile: File, cn: String, password: String) {
|
||||||
// align & sign
|
|
||||||
val cacheDirectory = File(cacheDirectory)
|
val cacheDirectory = File(cacheDirectory)
|
||||||
val alignedOutput = cacheDirectory.resolve("aligned.apk")
|
val alignedOutput = cacheDirectory.resolve("aligned.apk")
|
||||||
val signedOutput = cacheDirectory.resolve("signed.apk")
|
val signedOutput = cacheDirectory.resolve("signed.apk")
|
||||||
ZipAligner.align(inputFile, alignedOutput)
|
|
||||||
Signer(
|
|
||||||
cn,
|
|
||||||
password
|
|
||||||
).signApk(inputFile, signedOutput)
|
|
||||||
|
|
||||||
// write to output
|
// align the inputFile and write to alignedOutput
|
||||||
|
ZipAligner.align(inputFile, alignedOutput)
|
||||||
|
// sign the alignedOutput and write to signedOutput
|
||||||
|
// the reason is, in case the signer fails
|
||||||
|
// it does not damage the output file
|
||||||
|
Signer(cn, password).signApk(alignedOutput, signedOutput)
|
||||||
|
|
||||||
|
// afterwards copy over the file to the output
|
||||||
signedOutput.copyTo(outputFile)
|
signedOutput.copyTo(outputFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user