Signing apk with .p12

These commands worked for me:

keytool -importkeystore -srckeystore yourp12file.p12 -destkeystore keystorefile.keystore -srcstoretype pkcs12

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


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 myapk-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


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