How to sign and secure your .apk for Google Play

Quick overview on how to sign and secure your .apk for Google Play on a Windows machine. I also show a neat tool to zip align your .apk file as well.

Step 1 – OpenSSL

OpenSSL is an open-source implementation of the SSL and TLS protocols. OpenSSL can be used to create your own Self Signed SSL certificates.
You can download latest OpenSSL here: or version 0.9 here:

a) Create a private key with a password.

Type the command:
OpenSSL> genrsa -des3 -out my.key 1024
It will ask for a pass phrase. Enter a passphrase to continue. If you need 2048 bit encryption replace 1024 with 2048. The key is created as my.key in the openssl/bin folder. You may use your prefered name for the key.

b) Create a CSR which is Certificate Signing Request.

Enter the command to create CSR:
OpenSSL> req -new -key my.key -out request.csr
You might get an error saying: “unable to load config info from /usr/local/ssl/openssl.cnf windows ”. It’s becasue it can’t open config. So in this case you need to specify the absolute path to the config:
OpenSSL> req -new -key my.key -out request.csr -config D:\Programs\OpenSSL\openssl.cnf

Enter the details required and finally you will find a .csr file in your directory.

Note: The “challenge password” requested as part of the CSR generation is not the same thing as a passphrase used to encrypt the secret key. The “challenge password” is basically a shared-secret nonce between you and the SSL issuer, embedded in the CSR, which the issuer may use to authenticate you should that ever be needed. Should you choose to enter and use a challenge password, you will need to make sure that you save that password in a secure place. If you ever need to reinstall your certificate for any reason, you will be required to enter that password. Read more:

c) Sign your certificate.

Enter the following command:
OpenSSL> x509 -req -days 9999 -in request.csr -signkey my.key -out certificate.pem

Here 9999 is the number of days the certificate is valid for. It should be minimum 25 years.

d) Creating pk8x

pk8 is a file which contains the private key which can be useful when signing Android APK using SignAPK. Use the command to create pk8 file from PEM file

OpenSSL> pkcs8 -topk8 -outform DER -in my.key -inform PEM -out key.pk8 -nocrypt


Step 2 – SignAPK

You can download SignAPK.rar here:
Usage can be found here:

The created certificate.pem and key.pk8 of previous step need to placed in the Signapk folder. Also need to place your-app.apk in the same folder and run the following command in the cmd (inside the folder of signapk):

java -jar signapk.jar certificate.pem key.pk8 your-app.apk your-signed-app.apk
java -jar signapk.jar certificate.pem key.pk8
(execute this command in command line where you unzipped signapk and then run which line above suits your needs. You will need Java installed to execute this step.)

Step 3 – Zip Align

Download Zipalign to zip align your signed .apk file:
Further info on Zipalign can be found here:

Copy the signed.apk app file into the zipalign folder (also can try putting it in android sdk / tools folder) and run zipalign.exe. Select the .apk you want to zipalign. Then click zipalign.bat and it’ll create the zipasligned app in the ZipAlignApps folder.

Leave a Reply

Your email address will not be published. Required fields are marked *