0

Is there command to find the number of certificates in a PKCS#12 archive?

I have the .pfx file sent by a client but need to find out how many certificates it contains. I don't need any of the corresponding private keys.

Oracle Wallet Manager could be used but that requires converting the .pfx into an .p12 wallet.

2

Quick & Dirty:

$ openssl pkcs12 -in <CERTFILE> -nokeys -password pass: 2> /dev/null | grep -c "BEGIN CERTIFICATE"

Please be aware, that this assumes that there are no password(s) set. Otherwise you'll have to fiddle around with the password argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.