DEV Community

Surhid Amatya
Surhid Amatya

Posted on

Signing apk with .p12

Can I release an android apk using .p12 file? I don't have keystore file?

Regarding this question, developing Android applications for more than 7+ years my answer was NO.

What is .p12 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 the certificate. So, a .p12 file is for iOS development.

After answering this question in StackOverflow I got to know you can use .p12 file as well to sign an android apk.
Let's jump to procedure to convert your .p12 file to jks file.

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 -importkeystore -srckeystore xxxx.p12 -destkeystore xxxx.jks -srcstoretype pkcs12 -deststoretype jks -srcalias xxxx_alias_name -destalias xxxx_alias_name

In some cases you might need to define -destkeypass
otherwise jks file won't password on the key and studio may look for password generating an error.

Top comments (0)