Previously I used jarsigner tool for APK signatures. But jarsigner provides v.1 sign only.

So, I'm trying to move signing process to apksigner because I need v.2 signature as well.
And it works well when I use .jks for it.
Please, check example below.

  apksigner sign \
     --ks some.jks \
     --ks-pass pass:somepass \
     --v1-signing-enabled true \
     --v2-signing-enabled true \
     --v3-signing-enabled true \
     --v4-signing-enabled false \
     --out DESTINATION_APP \

Also I need option to sign APK with key and cert parameters.
I've tried to use my .key and .crt file from .jks storage but it returns me an error. enter image description here

According to the documentation key file must be in PKCS#8 format and cert in X.509.
Could you please tell me how can I export .key and .crt in correct formats?


  • @Robert, I've removed post from there. It was added to Serverfauld mistakenly.
    – Viktor
    Jul 27, 2022 at 8:33
  • I would try to open the JKS file using keystore-explorer.org and then export the private key using context menu.
    – Robert
    Jul 27, 2022 at 8:42


You must log in to answer this question.

Browse other questions tagged .