Code signing
Android APKSigner

Create Java KeyStore

5min

This section shows how to use the Java keytool commands to generate a new key pair on the Vectera Plus, create a Certificate Signing Request (CSR), issue a certificate through an internal or external CA, and import the signed certificate and its accompanying CA certificate into a Java keystore.

These steps ensure that you can use APKSigner and the signed certificate to sign an APK file in the next section.

The keytool application is included in the JDK installation, so you can run the keytool commands in this section with no additional configuration.

Generate a server key pair and self-signed certificate

1

Execute the following command:

Text


The -alias field sets a name to identify the key pair and certificate to be generated. It can be any name (for example, apksignerdemo).

2

When prompted for the keystore password, enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.

3

When prompted, answer questions about the server certificate shown in the following example, which all keytool and jarsigner commands moving forward use:

Text


Generate and export a Certificate Signing Request (CSR)

1

To generate and export a CSR, run the following command:

Text

2

When prompted for the keystore password, enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.

3

Get the CSR signed by a CA, either third-party or internal.

After it is signed, the server certificate returned by the CA is imported along with the CA certificate.

Import a CA root certificate

1

To import the CA root certificate, run the following command:

Text

2

When prompted for the keystore password, enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.

3

When prompted to trust the certificate, enter Yes.

Text


Import a server certificate signed by a CA

1

To import the signed server certificate, run the following command:

Text

2

When prompted for the keystore password, enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.

If the command succeeds, you should see an output similar to the following: Certificate reply was installed in keystore.