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.

Fadel
  • 21
  • 1
  • 5

1 Answers1

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.

Karol Babioch
  • 1,247
  • 8
  • 10