Skip to main content
Use this procedure to put a CA-signed certificate on the key pair you generated in Create a Java key store, or to renew that certificate before it expires. You generate a certificate signing request (CSR) from the existing private key, have your certificate authority (CA) sign it, and import the signed certificate back to the same alias. The private key never leaves the CryptoHub, and the alias does not change, so Jarsigner needs no configuration change.
Renewing the certificate on the same key pair is supported. Generate a new key pair instead when your key-rotation policy requires it or when your CA no longer accepts the key size. For example, CAs that issue publicly trusted code signing certificates require RSA 3072 or larger.

Before you begin

  • The key pair exists on the CryptoHub, and keytool -list shows it as a PrivateKeyEntry.
  • FXPKCS11_CFG points to your fxpkcs11.cfg in the shell where you run keytool, as described in Install and configure Futurex PKCS #11.
  • You have the signed certificate chain from your CA, or you can obtain it: the signed certificate plus every intermediate and root CA certificate.

Back up the current certificate

1
List the entries on the token and copy the exact alias of the key pair:
Shell
The entry shows as PrivateKeyEntry, with an alias in the form <alias>-<id>:<alias> (for example, jarsigner-demo-1784141140:jarsigner-demo).
2
Export the current certificate. Keep it, together with the CA chain it was issued with, so you can restore it if you need to:
Shell
current-cert.pem contains one PEM certificate.
When keytool prompts for the key store password, enter the CryptoHub identity password (PKCS #11 PIN) from the <CRYPTO-OPR-PASS> tag in fxpkcs11.cfg.

Generate a CSR from the existing key

Run the following command with the exact alias you copied. The CryptoHub signs the CSR with the existing private key; no new key is created:
Shell
openssl req -in renew.csr -noout -verify -subject reports Certificate request self-signature verify OK and shows the subject of the current certificate.
Submit renew.csr to your CA. Request the signed certificate together with its full chain, as a PKCS #7 file (.p7b) or as one PEM file that holds the signed certificate followed by each intermediate and root CA certificate.

Import the signed certificate

Import the full chain. If the file contains only the signed certificate, keytool cannot build the chain and stops with Failed to establish chain from reply. The certificate on the CryptoHub does not change when this happens.
1
Import the CA response to the same alias:
Shell
keytool prints Certificate reply was installed in keystore. If keytool asks whether to install a reply from a CA it does not trust, confirm that the root certificate in the file belongs to your CA, and then enter yes.
2
Confirm the result:
Shell
The entry keeps the same alias and is still a PrivateKeyEntry. The first certificate in the chain shows the new serial number, validity dates, and your CA as the issuer. The token holds one certificate for the alias: the import replaces the previous certificate rather than adding a second one.

Restart Jarsigner

Start every new jarsigner run after the import. A build agent or Java process that loaded the PKCS #11 key store before the import keeps the old certificate until it restarts.

Verify it works

Sign a test JAR as shown in Jarsigner command examples, then run jarsigner -verify -verbose -certs and confirm that the signer certificate shows the new serial number and expiration date.

Troubleshooting

To roll back, import the previous certificate and its full CA chain to the same alias with the same keytool -importcert command, and then restart Jarsigner.
The CSR command uses SHA256withRSA for the RSA key pairs this guide generates. Futurex validated this procedure on CryptoHub 7.0.3.x with Futurex PKCS #11 (FXPKCS11) 6.0 rev dc27 and 6.5, OpenJDK 21, and an RSA 3072 key pair.