A PKCS12 file (.pfx) contains a certificate and corresponding private key. Getting the expiration date is a two-step process.
Steps
1. Convert PFX to PEM
# Using -passin to avoid pem passphrase prompt
openssl pkcs12 -in testuser1.pfx -out temp.pem \
-passout pass:"${pass}" -passin pass:"${pass}"
### 2. Get the Expiration Date
bash
openssl x509 -in temp.pem -noout -enddate
This outputs the certificate expiration date.
#cli#openssl#security
About Hemanth HM
Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.