mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2024-12-21 07:00:22 +08:00
Print warning message when signature key is missing (#2283)
This commit is contained in:
parent
959c4d0698
commit
213b03ea56
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user