Thursday, January 12, 2012

Android application signing with PKCS12 (.p12) certificate

Here are few useful commands to sign the Android application with PKCS12 certificate.

* Import PKCS12 cert into keystore file:
keytool -importkeystore -srckeystore mycert.p12 -destkeystore mycert.keystore -srcstoretype pkcs12

* Change the certificate alias in the keystore if you like:
keytool -changealias -keystore mycert.keystore -destalias new_cert_alias -alias original_cert_alias

* List the keystore certificates (-v for verbose)
keytool -list -v -keystore mycert.keystore

* Sign the Android APK
jarsigner -verbose -keystore mycert.keystore myapp.apk cert_alias

* Verify that the APK is signed
jarsigner -verify -verbose -certs myapp.apk



No comments: