Print warning message when signature key is missing (#2283)
This commit is contained in:
@@ -56,7 +56,12 @@ fun createChecksum(file: File) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun attachSignature(jar: File) {
|
fun attachSignature(jar: File) {
|
||||||
val keyLocation = System.getenv("HMCL_SIGNATURE_KEY") ?: return
|
val keyLocation = System.getenv("HMCL_SIGNATURE_KEY")
|
||||||
|
if (keyLocation == null) {
|
||||||
|
logger.warn("Missing signature key")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val privatekey = KeyFactory.getInstance("RSA").generatePrivate(PKCS8EncodedKeySpec(File(keyLocation).readBytes()))
|
val privatekey = KeyFactory.getInstance("RSA").generatePrivate(PKCS8EncodedKeySpec(File(keyLocation).readBytes()))
|
||||||
val signer = Signature.getInstance("SHA512withRSA")
|
val signer = Signature.getInstance("SHA512withRSA")
|
||||||
signer.initSign(privatekey)
|
signer.initSign(privatekey)
|
||||||
|
|||||||
Reference in New Issue
Block a user