Generating Keys

From Android Wiki

Revision as of 01:45, 2 August 2009 by Tonyb486 (Talk | contribs)
Jump to: navigation, searcha

When you publish an app on the market, you need to sign it with a personal private key. The typical way to generate the key is with keytool, and then sign it with jarsigner. But this is generally a pain ;)

The git source tree has a SignApk.jar utility that is easier to use to sign apks. You can use the following three steps to generate a key and certificate that can be used with SignApk.jar

openssl genrsa -out key.pem 1024
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt

Then, you can sign an apk using the SignApk.jar tool and the key.pk8 and certificate.pem files you created

java -jar SignApk.jar certificate.pem key.pk8 Application.apk Application_signed.apk
Personal tools