Error running PEPK app signing tool at command line (java -jar pepk.jar)

Gary Bentley picture Gary Bentley · Sep 11, 2018 · Viewed 11.9k times · Source

I'm getting the output:

Error: null

from the command (executed at the command line):

java -jar pepk.jar --keystore=my.keystore --alias=x --output=my.output --encryptionkey=1243

Anyone any idea why or how to resolve it?

The "my.keystore" file exists and is a keystore. The alias is correct and the "my.output" file doesn't exist. I have changed the encryptionkey value in the example above but no matter what values I use I always get the same output.

I've tried double quoting the keystore and output values and providing (with quotes) full paths to the keystore file and the output file. Still the same error output. The jar is being executed because I get the usage help displayed if something is missing. I've also tried running the command in different directories and ensured that the permissions in the output directory is correct.

I'm using java version:

java version "9" Java(TM) SE Runtime Environment (build 9+181) Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

on Windows 10. (I've tried paths with both / and ). The pepk.jar was downloaded on the same day this question was posted from the App Signing page on the Play Store for my app.

Update, with new version downloaded as of 17/Sep/2018:

After downloading the new version of pepk.jar as suggested by Pierre the output is now:

Error: Unable to export or encrypt the private key
java.lang.NullPointerException
at com.google.wireless.android.vending.developer.signing.tools.extern.export.KeystoreHelper.loadKeystore(KeystoreHelper.java:45)
at com.google.wireless.android.vending.developer.signing.tools.extern.export.KeystoreHelper.getPrivateKey(KeystoreHelper.java:38)
at com.google.wireless.android.vending.developer.signing.tools.extern.export.ExportEncryptedPrivateKeyTool.run(ExportEncryptedPrivateKeyTool.java:114)
at com.google.wireless.android.vending.developer.signing.tools.extern.export.ExportEncryptedPrivateKeyTool.main(ExportEncryptedPrivateKeyTool.java:79)

I've double checked the keystore and it contains a private key, via the use of keytool -list -v -keystore.

Answer

droidBomb picture droidBomb · Sep 13, 2018

You have atleast Java Version 8(JDK 1.8) to run the syntax:

java -jar PATH_TO_PEPK --keystore=PATH_TO_KEYSTORE --alias=ALIAS_YOU_USE_TO_SIGN_APK --output=PATH_TO_OUTPUT_FILE --encryptionkey=GOOGLE_ENCRYPTION_KEY

Legend:

  • PATH_TO_PEPK = Path to the pepk.jar you downloaded, could be something like C:\Users\YourName\Downloads\pepk.jar for Windows users.
  • PATH_TO_KEYSTORE = Path to keystore which you use to sign your release APK. Could be a file of type *.keystore or *.jks or without extension. Something like C:\Android\mykeystore or C:\Android\mykeystore.keystore.
  • ALIAS_YOU_USE_TO_SIGN_APK = The name of the alias you use to sign the release APK.
  • PATH_TO_OUTPUT_FILE = The path of the output file with .pem extension, something like C:\Android\private_key.pem
  • GOOGLE_ENCRYPTION_KEY = This encryption key should be always the same. You can find it in the App Signing page, copy and paste it. Should be in this form: eb10fe8f7c7c9df715022017b00c6471f8ba8170b13049a11e6c09ffe3056a104a3bbe4ac5a955f4ba4fe93fc8cef27558a3eb9d2a529a2092761fb833b656cd48b9de6a

Example:

java -jar "C:\Users\YourName\Downloads\pepk.jar"
--keystore="C:\Android\mykeystore" --alias=myalias --output="C:\Android\private_key.pem" --encryptionkey=eb10fe8f7c7c9df715022017b00c6471f8ba8170b13049a11e6c09ffe3056a104a3bbe4ac5a955f4ba4fe93fc8cef27558a3eb9d2a529a2092761fb833b656cd48b9de6a

After entering the command in the terminal, you will need to provide the following:

  1. The keystore password
  2. The alias password

If everything has gone OK, you now will have a file in PATH_TO_OUTPUT_FILE folder called private_key.pem.

More resources: