bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Cannot build android project with .jks keystore

Open alex-mac opened this issue 3 years ago • 2 comments

Hi there.

I recently went through the process of generating a new .jks and .pem file, as found in issue 454. I get an error saying my build failed due to an invalid keystore format. I am using Node v14.17.0, and the latest version of bubblerwrap.

Any insight into how to move forward with the build would be much appreciated.

twa-manifest.json signing key section

"signingKey": {
    "path": "/Users/amac/company/repos/repo/keystore.jks",
    "alias": "upload"
  },

How I generated the keystore

keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks

What I did

bubblewrap build

What I expected

A new .apk and .aab to be generated

What I actually get

Screen Shot 2021-06-18 at 12 07 36 PM

alex-mac avatar Jun 18 '21 19:06 alex-mac

I think I figured out what was wrong:

The keystore I generated was a PKCS12 keystore, whereas bubblewrap CLI was expecting a JKS keystore.

For those who stumble into the same situation, I verified my keystore type using:

keytool -list -keystore path/to/my/key.jks

and I converted the keystore type using a command I found at knowledge.broadcom.com

To convert a PKCS12 (.p12) keystore to a JKS (.jks) keystore, please run the following command:

keytool -importkeystore -srckeystore key.p12 -srcstoretype pkcs12 -destkeystore key.jks -deststoretype jks

where key.p12 is the name of the p12 file and key.jks is the name of the jks keystore to be created.

NOTE: This command is supported on JDK / JRE keytool versions 1.6 and greater.

My issue is resolved (yay!), but the next question I have is whether bubblwrap's cli tool should support PKCS12 keystores?

alex-mac avatar Jun 19 '21 00:06 alex-mac

I'm not opposed to supporting PKCS12, but is unlikely to be a priority unless someone from the community wants to take it. Would you mind creating an specific issue for this, as a feature request?

andreban avatar Sep 24 '21 16:09 andreban