Android Question Signature Files for APK sign - pk8 and .x509.pem

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hello

One of our suppliers of phone has sent us *.pk8 and *.x509.pem file, they are media, platform, releasekey, shared, testkey, and verify. This file will allow us have our apps as system app on their devices.

I am unsure how to use these files, but from reading I need to sign our apps.

Any help would be appreciated.

Regards

John.
 

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi, this is how I managed to do it, based on the stackoverflow post that sent Erel.
(Note: I used "b4a" as alias to be able to use it in B4A under "Tools > Private Sign Key")

  1. Get a PEM
    B4X:
    openssl pkcs8 -in platform.pk8 -inform DER -outform PEM -out platform.priv.pem -nocrypt

  2. Create a PK12
    (You will be asked to set a password)
    B4X:
    openssl pkcs12 -export -in platform.x509.pem -inkey platform.priv.pem -out platform.pk12 -name b4a

  3. Create the Keystore
    (In this step you will be asked for the password set in the previous step AND to set a new password for the Keystore, I used the same to not mess it up)
    B4X:
    keytool -importkeystore -destkeystore platform.jks -srckeystore platform.pk12 -srcstoretype PKCS12 -alias b4a

  4. Test if everything is successful
    B4X:
    keytool -list -keystore platform.jks

  5. You can now use it as a normal keystore file to sign your APKs by putting it under "Tools > Private Sign Key" with you password
 
  • Like
Reactions: byz
Upvote 0
Top