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.
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.
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:
*.keystore or *.jks or without extension. Something like C:\Android\mykeystore or C:\Android\mykeystore.keystore..pem extension, something like C:\Android\private_key.pem
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:
If everything has gone OK, you now will have a file in PATH_TO_OUTPUT_FILE folder called private_key.pem.
More resources:
I finally got around this problem by using the standard Windows (10) command prompt, i.e. "cmd". It seems that the System.getConsole is returning a non null value for cmd.
I haven't been able to find any information on what is happening with mingw64 (the command prompt I generally use on Windows) and why the System.getConsole isn't being set up.
If you are using gitbash, you have to pre-fix the command with
winpty
as the PEPK command requires console input.
(or run is via a standard windows CMD prompt)
I really appreciate the response given by @droidBomb in previous Answer.
The solution for xamarin Android is slight different. REQUIRED FLAGS
--keystore Path to the keystore containing the private key to export(Eg:C:\Users\YourName\Downloads\abc.keystore)"
--alias Alias of the private key in the keystore(Eg:upload)
--encryptionkey Public key to encrypt the private key with. This will be be the hex encoded bytes of the public key. The public key is a 4-byte identity followed by a 64-byte P256 point.(Eg: eb10fe8f7c7c9df715022017b00c6471f8ba8170b13049a11e6c09ffe3056a104a3bbe4ac5a955f4ba4fe93fc8cef27558a3eb9d2a529a2092761fb833b656cd48b9de6a)
--output File in which to output the encrypted private key.(Eg:C:\Users\YourName\Downloads\private_key.pem)
The respective pem file will be generated at output path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With