File tree 2 files changed +8
-4
lines changed
src/main/kotlin/app/revanced
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,10 @@ object Signing {
16
16
// sign the alignedOutput and write to signedOutput
17
17
// the reason is, in case the signer fails
18
18
// it does not damage the output file
19
- Signer (cn, password).signApk(alignedOutput, signedOutput)
19
+ val keyStore = Signer (cn, password).signApk(alignedOutput, signedOutput)
20
20
21
- // afterwards copy over the file to the output
21
+ // afterwards copy over the file and the keystore to the output
22
22
signedOutput.copyTo(outputFile, true )
23
+ keyStore.copyTo(outputFile.resolveSibling(keyStore.name), true )
23
24
}
24
25
}
Original file line number Diff line number Diff line change @@ -48,10 +48,11 @@ internal class Signer(
48
48
return JcaX509CertificateConverter ().getCertificate(builder.build(signer)) to pair.private
49
49
}
50
50
51
- fun signApk (input : File , output : File ) {
51
+ fun signApk (input : File , output : File ): File {
52
52
Security .addProvider(BouncyCastleProvider ())
53
53
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" )
55
56
if (! ks.exists()) newKeystore(ks)
56
57
57
58
val keyStore = KeyStore .getInstance(" BKS" , " BC" )
@@ -70,5 +71,7 @@ internal class Signer(
70
71
signer.setOutputApk(output)
71
72
72
73
signer.build().sign()
74
+
75
+ return ks
73
76
}
74
77
}
You can’t perform that action at this time.
0 commit comments