1

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?

Violet Giraffe
  • 29,070
  • 38
  • 172
  • 299
  • 1
    Is your cert valid for 10 years or more? The Android market requieres a huge long period. See also http://stackoverflow.com/questions/3985419/how-do-i-create-a-certificate-for-my-android-market-apk – rekire Dec 06 '11 at 14:55
  • @rekire: Thanks for the heads-up! BTW, the autogenerated cert (which I got after following the tutorials on web) is only valid for 6 months. Weird. – Violet Giraffe Dec 06 '11 at 15:19
  • Possible duplicate of [Signing apk with .p12](http://stackoverflow.com/questions/19829630/signing-apk-with-p12) – Ohad Cohen Jun 06 '16 at 10:27

1 Answers1

0

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.

Karthikeyan VK
  • 3,430
  • 3
  • 26
  • 39