mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-13 13:47:47 +01:00
fix: move the keystore to the output directory
This commit is contained in:
parent
6c6abafe95
commit
6ceb449cf8
@ -16,9 +16,10 @@ object Signing {
|
|||||||
// sign the alignedOutput and write to signedOutput
|
// sign the alignedOutput and write to signedOutput
|
||||||
// the reason is, in case the signer fails
|
// the reason is, in case the signer fails
|
||||||
// it does not damage the output file
|
// it does not damage the output file
|
||||||
Signer(cn, password).signApk(alignedOutput, signedOutput)
|
val keyStore = Signer(cn, password).signApk(alignedOutput, signedOutput)
|
||||||
|
|
||||||
// afterwards copy over the file to the output
|
// afterwards copy over the file and the keystore to the output
|
||||||
signedOutput.copyTo(outputFile, true)
|
signedOutput.copyTo(outputFile, true)
|
||||||
|
keyStore.copyTo(outputFile.resolveSibling(keyStore.name), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,11 @@ internal class Signer(
|
|||||||
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
|
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
|
||||||
}
|
}
|
||||||
|
|
||||||
fun signApk(input: File, output: File) {
|
fun signApk(input: File, output: File): File {
|
||||||
Security.addProvider(BouncyCastleProvider())
|
Security.addProvider(BouncyCastleProvider())
|
||||||
|
|
||||||
val ks = File(input.parent, "revanced-cli.keystore")
|
// TODO: keystore should be saved securely
|
||||||
|
val ks = File(input.parent, "${output.nameWithoutExtension}.keystore")
|
||||||
if (!ks.exists()) newKeystore(ks)
|
if (!ks.exists()) newKeystore(ks)
|
||||||
|
|
||||||
val keyStore = KeyStore.getInstance("BKS", "BC")
|
val keyStore = KeyStore.getInstance("BKS", "BC")
|
||||||
@ -70,5 +71,7 @@ internal class Signer(
|
|||||||
signer.setOutputApk(output)
|
signer.setOutputApk(output)
|
||||||
|
|
||||||
signer.build().sign()
|
signer.build().sign()
|
||||||
|
|
||||||
|
return ks
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user