20

I am going to update my client's app which is available on Google PlayStore. And I have only a .p12 file with password, not .keystore file.

I am wondering if it's possible to publish the updated version to Google PlayStore.

Sorry for basic question. I am so confused with that. Thank you in advance for your assistance.

Joey
  • 2,774
  • 2
  • 25
  • 32

4 Answers4

27

You can just convert your p12 file to jks:

Create an empty JKS store

keytool -genkey -alias anyname -keystore yourcertificate.jks
keytool -delete -alias anyname -keystore yourcertificate.jks

Import yourcertificate.p12 into yourcertificate.jks

keytool -v -importkeystore -srckeystore yourcertificate.p12 -srcstoretype PKCS12 -destkeystore yourcertificate.jks -deststoretype JKS

You can also check this link: http://shib.kuleuven.be/docs/ssl_commands.shtml#keytool

authcate
  • 1,153
  • 6
  • 13
  • 4
    keytool -importkeystore -srckeystore xxxx.p12 -destkeystore xxxx.jks -srcstoretype pkcs12 -deststoretype jks -srcalias xxxx_alias_name -destalias xxxx_alias_name – Joey Nov 13 '13 at 01:30
  • 1
    In my case I had to specify `-destkeypass`, otherwise it had put no password on the key and studio didn't get it. – Ohad Cohen Jun 06 '16 at 10:58
  • Is pkcs12 still not supported by Google Play Store? Please see https://stackoverflow.com/q/59317011/2342558 – user2342558 Dec 13 '19 at 07:40
4

These commands worked for me:

keytool -importkeystore -srckeystore yourp12file.p12 -destkeystore keystorefile.keystore -srcstoretype pkcs12
baudsp
  • 3,897
  • 1
  • 19
  • 32
William Grand
  • 761
  • 2
  • 8
  • 21
2

You gonna use the flag -storetype PKCS12

First, create your keystore with its alias [ on this ex. mykeystore and myalias ]

keytool -genkey -alias myalias -keystore mykeystore -storetype PKCS12 -keyalg RSA -validity 3650 -keysize 2048

And just sign your APK

jarsigner -keystore mykeystore my.apk myalias

In case you need to align the app, use zipalign command before and do the signing with the aligned one, like so:

zipalign -f -p 4 my.apk myapk-aligned.apk

jarsigner -keystore mykeystore my-aligned.apk myalias

Flags used on zipalign

-f overwrite existing outfile

-p page align stored shared object files

-v if you want to see the verbose log, use that


The -validity 3650 was used to expire the signing in 10 years

PYK
  • 2,267
  • 18
  • 13
1

No, you can't use .p12 file to uplaod app to Google PlayStore. You need .keystore file.

A P12 file (a file with a .p12 extension) is a type of certificate file (a Personal Information Exchange file). The Packager for iPhone uses this type of certificate to build an iPhone application. You convert the developer certificate you receive from Apple into this form of certificate. So, a .p12 file is for iOS development.

On the other hand, you could try doing a system restore, on your computer, to a previous date in which you haven't misplaced or deleted your key yet.

Also you can view:

  1. Android Keystore File Lost

  2. Lost my keystore for uploaded app on android market

Community
  • 1
  • 1
surhidamatya
  • 1,603
  • 28
  • 53
  • 1
    Thank you. I also thought .p12 file is for iOS development. but I could sign apk file with P12 file. You can have a look at authcate's answer. – Joey Nov 13 '13 at 01:27
  • Good to hear that. Thanks for letting us know new thing. Upvoted your question – surhidamatya Nov 13 '13 at 05:19