Your PCI assessment is on the calendar, and somewhere in the evidence request is a line asking for your inventory of trusted keys and certificates. If your first thought was “we have a spreadsheet… somewhere,” this post is for you.
PCI DSS 4.2.1.1 is one of the requirements that came in with version 4.0 as a best practice and became mandatory after March 31, 2025. So if your last assessment was before that date, this may be the first time an assessor actually holds you to it. The good news is that it’s one of the more straightforward requirements to meet. It just takes some legwork the first time.
Here’s what it asks for, what goes in the inventory, and a script to get the first draft built this afternoon.
What PCI DSS 4.2.1.1 actually says
The requirement itself is one sentence: an inventory of the entity’s trusted keys and certificates used to protect PAN during transmission is maintained. PAN is the primary account number, the card number.
The guidance that goes with it explains the point. A good inventory helps you keep track of the algorithms, protocols, key strength, key custodians, and key expiry dates for those keys and certificates. That list is basically your column headers, which we’ll get to.
It sits right next to Requirement 4.2.1, which got a matching update at the same time. Certificates used to protect PAN over open, public networks now have to be confirmed as valid and not expired or revoked. The two go together. You can’t confirm every certificate is valid if you don’t know which certificates you have.
One more sibling worth knowing about: Requirement 12.3.3 asks for an inventory of the cryptographic cipher suites and protocols in use, reviewed at least once every 12 months. If you’re building one inventory, it’s worth building them together.
Figure out what’s in scope first
Don’t start by scanning everything. Start with your cardholder data flows, because the requirement is scoped to keys and certificates that protect card data in transit. Pull up your data-flow diagram and walk every hop that carries PAN.
For a typical small or mid-size merchant, that usually includes:
- Public-facing payment pages and APIs. The TLS certificate on your checkout site or payment API.
- Connections to your payment processor or gateway. If your app authenticates to the gateway with a client certificate, that certificate and its private key belong in the inventory.
- Internal hops inside the cardholder data environment. App server to database, app server to an internal API, load balancer to backend. These are often issued by your internal CA, and they’re the ones nobody remembers.
- The “trusted” side. The requirement says trusted keys and certificates. That covers the CA certificates and pinned certificates your systems rely on to decide who to trust when they connect out, not only the certificates you present.
The written requirement text doesn’t limit 4.2.1.1 to public networks the way 4.2.1 is. Some assessors read it to cover every PAN transmission, internal hops included, and some don’t. Ask your QSA how they read it before you decide what’s out of scope. Including internal hops costs you a few extra rows. Leaving them out costs you a finding.
Also worth knowing: the applicability notes on 4.2.1 say a certificate from your own internal CA can be acceptable. The author has to be confirmed, the certificate verified, and it can’t be expired. So internal certs don’t have to be ripped out. They do have to be tracked.
What goes in the inventory
There’s no official template, so here’s a set of columns that covers the guidance and answers the questions assessors tend to ask:
| Column | Why it’s there |
|---|---|
| Endpoint or system | Where the cert lives (host:port, device, or app) |
| Data flow | Which PAN transmission it protects |
| Subject and SANs | What names the cert covers |
| Issuer | Public CA, internal CA, or self-signed |
| Expiration date | Covers the “key expiry dates” guidance and 4.2.1’s not-expired check |
| Key algorithm and size | Covers “algorithms” and “key strength” |
| Protocols allowed | TLS versions the endpoint accepts |
| SHA-256 fingerprint | Proves which exact cert you inventoried |
| Custodian | The person or team responsible for the key |
| Renewal process | How it gets replaced, and who does it |
| Last reviewed | Shows the inventory is maintained, not a one-time export |
That last column matters more than it looks. The requirement says the inventory is maintained. A spreadsheet you built the week before the assessment and never touched again is a hard sell.
A script to build the first draft
Most of those columns come straight off the certificate. Put every in-scope endpoint in a file called hosts.txt, one host:port per line, and this script pulls the certificate from each one and writes a CSV:
#!/usr/bin/env bash
# pci-cert-inventory.sh - pull certificate details from in-scope TLS endpoints
# hosts.txt: one host:port per line, lines starting with # are skipped
echo "endpoint,subject,issuer,not_after,public_key,signature_algorithm,sha256_fingerprint"
while IFS= read -r ep; do
[[ -z "$ep" || "$ep" == \#* ]] && continue
host="${ep%%:*}"
pem=$(echo | timeout 10 openssl s_client -connect "$ep" -servername "$host" 2>/dev/null \
| openssl x509 2>/dev/null)
if [[ -z "$pem" ]]; then
echo "\"$ep\",ERROR,,,,,"
continue
fi
subject=$(openssl x509 -noout -subject -nameopt RFC2253 <<<"$pem" | sed 's/^subject=//')
issuer=$(openssl x509 -noout -issuer -nameopt RFC2253 <<<"$pem" | sed 's/^issuer=//')
not_after=$(openssl x509 -noout -enddate <<<"$pem" | cut -d= -f2)
pubkey=$(openssl x509 -noout -text <<<"$pem" | grep -m1 'Public-Key' | sed 's/^ *//')
sigalg=$(openssl x509 -noout -text <<<"$pem" | grep -m1 'Signature Algorithm' | awk -F': ' '{print $2}')
fp=$(openssl x509 -noout -fingerprint -sha256 <<<"$pem" | cut -d= -f2)
echo "\"$ep\",\"$subject\",\"$issuer\",\"$not_after\",\"$pubkey\",\"$sigalg\",\"$fp\""
done < hosts.txt
Run it with ./pci-cert-inventory.sh > inventory.csv, open the CSV, and add the columns a script can’t know: data flow, custodian, renewal process, and last reviewed.
If you just want a quick pass/fail on expiration for a single cert, openssl has that built in. This exits non-zero if the cert expires within 30 days (2,592,000 seconds):
echo | openssl s_client -connect pay.example.com:443 -servername pay.example.com 2>/dev/null \
| openssl x509 -noout -checkend 2592000
A few things the script won’t catch, so plan for them:
- Client certificates. If your app presents a client cert to the gateway, it isn’t sitting on a port you can scan. Pull it from the server’s certificate store or the app’s config.
- Trust stores and pinned certs. Check which CA bundle or pinned certificate your payment integration actually uses. That’s the “trusted keys” half of the requirement.
- Certs behind a load balancer. Scanning the public name shows you the load balancer’s cert. If TLS is re-encrypted to the backend, scan the backend hosts too.
On Windows hosts, the Get-ChildItem Cert:\LocalMachine\My approach works for pulling what’s installed, and if your internal hops use certificates from an AD CS issuing CA, the CA database is the fastest place to find them.
Keep it maintained
Building the inventory is a one-afternoon job. Keeping it accurate is the actual requirement. A few habits help:
- Re-run the script on a schedule and diff it against last time. New certs, changed fingerprints, and new issuers all mean something changed in your cardholder data environment.
- Update it as part of change management. Any change that adds a system or a connection to the CDE adds a row.
- Tie expiration to alerts, not to the spreadsheet. The inventory tells you what exists. Something still has to tell the custodian when a cert is coming due, or 4.2.1’s “not expired” check fails on the day it matters.
- Date your reviews. When the assessor asks how the inventory is maintained, “here are the last four quarterly reviews” is a much better answer than “I updated it last week.”
If you want the bigger picture on getting certificate evidence ready for an audit, I covered SOC 2, ISO 27001, and PCI together in the certificate audit preparation guide. And if your internal certs are the part you’re least sure about, start with the internal PKI blind spot and certificate discovery.
Where CertMS fits
The spreadsheet-plus-script approach can absolutely pass an assessment. Where it struggles is the “maintained” part, every quarter, after the person who built it moves on.
CertMS gives you the live version of that inventory. URL monitoring covers your public payment endpoints. Lightweight agents on your Windows and Linux servers report the certificates actually installed, including the internal hops a port scan misses. A PowerShell agent on your issuing CA reports every certificate it issues. Each certificate is associated with the servers it lives on, and you can attach your own documentation to it, like the custodian and the renewal steps for that payment gateway client cert.
Scheduled reports give you dated evidence for the assessor, and help desk tickets or webhooks fire a set number of days before anything expires, which is the 4.2.1 half of the problem. CertMS only monitors. It never touches your keys or sits in the issuance path, so it doesn’t add anything new to your PCI scope to argue about.
If you’d rather walk into your next assessment with that inventory already running, take a look at CertMS. Either way, run the script against your payment endpoints this week. It’s a lot less stressful to find the surprises before your assessor does.