Skip to content

Commit 6ceb449

Browse files
committed
fix: move the keystore to the output directory
1 parent 6c6abaf commit 6ceb449

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/kotlin/app/revanced/cli/signing/Signing.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ object Signing {
1616
// sign the alignedOutput and write to signedOutput
1717
// the reason is, in case the signer fails
1818
// it does not damage the output file
19-
Signer(cn, password).signApk(alignedOutput, signedOutput)
19+
val keyStore = Signer(cn, password).signApk(alignedOutput, signedOutput)
2020

21-
// afterwards copy over the file to the output
21+
// afterwards copy over the file and the keystore to the output
2222
signedOutput.copyTo(outputFile, true)
23+
keyStore.copyTo(outputFile.resolveSibling(keyStore.name), true)
2324
}
2425
}

src/main/kotlin/app/revanced/utils/signing/Signer.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ internal class Signer(
4848
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
4949
}
5050

51-
fun signApk(input: File, output: File) {
51+
fun signApk(input: File, output: File): File {
5252
Security.addProvider(BouncyCastleProvider())
5353

54-
val ks = File(input.parent, "revanced-cli.keystore")
54+
// TODO: keystore should be saved securely
55+
val ks = File(input.parent, "${output.nameWithoutExtension}.keystore")
5556
if (!ks.exists()) newKeystore(ks)
5657

5758
val keyStore = KeyStore.getInstance("BKS", "BC")
@@ -70,5 +71,7 @@ internal class Signer(
7071
signer.setOutputApk(output)
7172

7273
signer.build().sign()
74+
75+
return ks
7376
}
7477
}

0 commit comments

Comments
 (0)