Skip to content

Commit

Permalink
fix: sign the aligned file instead of the input file
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 11, 2022
1 parent a0644c7 commit 22d2535
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/kotlin/app/revanced/cli/signing/Signing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import java.io.File

object Signing {
fun start(inputFile: File, outputFile: File, cn: String, password: String) {
// align & sign
val cacheDirectory = File(cacheDirectory)
val alignedOutput = cacheDirectory.resolve("aligned.apk")
val signedOutput = cacheDirectory.resolve("signed.apk")

// align the inputFile and write to alignedOutput
ZipAligner.align(inputFile, alignedOutput)
Signer(
cn,
password
).signApk(inputFile, signedOutput)
// 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)

// write to output
// afterwards copy over the file to the output
signedOutput.copyTo(outputFile)
}
}

0 comments on commit 22d2535

Please sign in to comment.