---
title: "Getting the Expiry Date of PFX (PKCS12)"
description: "How to extract certificate expiration date from PFX files using OpenSSL. Practical notes and code examples on Getting the."
url: "https://h3manth.com/scribe/getting-expiry-date-of-pfx-pkcs12/"
canonical_url: "https://h3manth.com/scribe/getting-expiry-date-of-pfx-pkcs12/"
markdown_url: "https://h3manth.com/scribe/blog/getting-expiry-date-of-pfx-pkcs12.md"
publishDate: "2013-04-29T00:00:00.000Z"
author: "Hemanth HM"
category: "security"
tags: ["cli","openssl","security"]
word_count: 67
reading_time_minutes: 1
x_markdown_tokens: 200
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Getting the Expiry Date of PFX (PKCS12)

> How to extract certificate expiration date from PFX files using OpenSSL. Practical notes and code examples on Getting the.

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

```bash
# 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.
