1

I have a p7b certificate(DER encoded) which I need to convert to a PEM encoded certificate so that I can import it into my keystore.

I see that the openssl command below does the job of the conversion

openssl pkcs7 -in infile.p7b -inform DER -print_certs -outform PEM -out outfile.cer

Is there any equivalent keytool command or Java code for the same?

1 Answer 1

1

Your .p7b file is probably a PKCS#7 encoded certificate chain.

For Java code to pull a single public key from that file, see Extracting individual .cer certificate from a .p7b file in java.

To use keytool to import one or more of the public keys, try Import PKCS7 (Chained Certificate) using KeyTool command to JKS. As noted, you might have to separate the public keys into individual files and just loop through them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .