chris01
chris01

Reputation: 12431

JCE: Store a private-key only without cert-chain

With Java and JCE - I have to create a keypair, store it in a keystore and create a certificate-request.

As far I see I can only store a private-key with a certificate-chain. But I do not have the certificate yes - but I need to store the key inside the keystore.

How to do that? Is it possible that I can store a private key without a cert-chain or have an empty cert-chain?

KeyPair kp = ...
Keystore ks = ...
 
PrivateKeyEntry e = new PrivateKeyEntry (kp.getPrivate (), null);  // null does not work for cert-chain -> null  exception
ks.setEntry (id, e, pp);
        

Upvotes: 1

Views: 75

Answers (0)

Related Questions