简体   繁体   中英

How to sign application with existing .cer, .p12 or .pfx certificate?

I want to sign Android app with the same certificate used for the desktop app. I have 3 files - .cer, .p12 and .pfx. Is it possible to use any of those for signing Android app?

Update : I have successfully imported the .cer key (which appears to be X.509-format certificate) into the newly created keystore, but I can't use it for signing. Here's the error message jarsigner gives me:

Certificate chain not found for: [alias]. key must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

Perhaps, there's something else I must do with a keystore after importing the certificate to make it valid? Generate a public key or something?

Did you create the keystore with -validity then this issue will appear, remove the -validity. It will work.

keytool -importkeystore -srckeystore  certificate/xxxxx.pfx -srcstoretype pkcs12 -destkeystore certificate/xxxxx.keystore  -deststoretype JKS **-validity 36500**

Change to

keytool -importkeystore -srckeystore  certificate/xxxxx.pfx -srcstoretype pkcs12 -destkeystore certificate/xxxxx.keystore  -deststoretype JKS

I had this issue it got sorted because of trying to add validity to a pfx which has valid expiry date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM