开发者

Trying to refresh 'expired' keystore

开发者 https://www.devze.com 2023-02-07 08:11 出处:网络
I am trying to re-sign some jars using the ant task \'signjar\' however it\'s telling me \"The signer certificate has expired.\"

I am trying to re-sign some jars using the ant task 'signjar' however it's telling me "The signer certificate has expired."

So I tried to re-generate the keystore hoping this would 'un-expire' it...

keytool -genkey -keystore mykeystore -alias myalias

but after entering the keystore password i get: "keytool error: java.lang.Exception: Key pair not generated, alias already exists"

what am i doing wrong? do i need to delete the keystore to re-genera开发者_运维问答te it or is there a simple way to refresh it so it's not expired?

thanks.


You're mixing up the terms. A keystore contains keys, a key is something used for signing.

AFAIK, you're trying to put a new key into an old keystore using an existing alias (name). Why don't you simply used a new one? Either this or delete the old key from the keystore first. You don't need to drop the whole keystore.

Have a look at portecle, this simple tool allows you to manipulate the keystore more easily.


For this simply regenerate you certificate again follow these steps.

   1)keytool -genkey -v -keystore mycertificate.keystore -alias mykey -keyalg 
   RSA -keysize 2048 -validity 1000
   2)  jarsigner -verbose -keystore mycertificate.keystore D:\app.apk mykey
   3) jarsigner -verify app.apk
     If it  will have done then shows a message "successfully verified"
   4) zipalign -v 4 D:\app.apk D:\signedapp.apk

  it will generate new certificate. enjoy :)
0

精彩评论

暂无评论...
验证码 换一张
取 消