CyberChef Parse X.509 Certificate

Category: Security Operation: Parse X.509 Certificate
X.509 SSL/TLS Certificates PKI Cryptography

What is X.509?

X.509 is an ITU-T standard for Public Key Infrastructure (PKI) and Privilege Management Infrastructure (PMI) that defines the format of public key certificates. These certificates are used in many internet protocols, including TLS/SSL for HTTPS, which secures web browsing, email encryption (S/MIME), code signing, and various authentication mechanisms.

An X.509 certificate binds an identity (such as a domain name, organization, or individual) to a public key using a digital signature from a trusted Certificate Authority (CA). This allows parties to verify that a public key belongs to the claimed identity, forming the foundation of secure communications on the internet.

Everyday Usage: Every time you see the padlock icon in your browser's address bar indicating a secure HTTPS connection, an X.509 certificate is being used to verify the website's identity and establish encrypted communication. Your browser checks the certificate to ensure you're really connecting to the legitimate website and not an imposter.

Certificate Structure

An X.509 certificate contains several key components organized in a standardized structure:

Version
Certificate format version (v1, v2, or v3). Modern certificates use v3 which supports extensions.
Serial Number
Unique identifier assigned by the Certificate Authority for tracking and revocation.
Signature Algorithm
Cryptographic algorithm used to sign the certificate (e.g., SHA256-RSA, ECDSA).
Issuer
Distinguished Name (DN) of the Certificate Authority that issued the certificate.
Validity Period
Not Before and Not After dates defining when the certificate is valid.
Subject
Distinguished Name (DN) of the certificate holder (domain, organization, person).
Subject Public Key Info
The public key and algorithm identifier (RSA, ECDSA, etc.).
Extensions (v3)
Additional fields like Subject Alternative Names (SANs), key usage, extended key usage.
Signature
Digital signature from the CA, proving the certificate's authenticity.

Certificate Formats

X.509 certificates can be encoded in different formats:

PEM (Privacy-Enhanced Mail)

Base64-encoded certificate wrapped in BEGIN/END markers. Most common format for web servers and applications.

-----BEGIN CERTIFICATE----- MIIDXTCCAkWgAwIBAgIJAKL0UG+mRcSdMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX aWRnaXRzIFB0eSBMdGQwHhcNMTcwODIyMDUwNTI5WhcNMTgwODIyMDUwNTI5WjBF ... -----END CERTIFICATE-----

DER (Distinguished Encoding Rules)

Binary format. Commonly used for certificates in Java applications and some Windows environments.

PKCS#7 / P7B

Can contain multiple certificates (certificate chain). Used for certificate distribution.

PKCS#12 / PFX

Binary format that can store certificate and private key together, often password-protected.

Format Conversion: CyberChef can parse certificates in PEM or DER format. If you have a different format, you may need to convert it first using other CyberChef operations like "From Base64" for PEM or direct binary input for DER.

Using Parse X.509 Certificate in CyberChef

CyberChef's Parse X.509 Certificate operation extracts and displays all information from an X.509 certificate in a human-readable format. This is invaluable for certificate inspection, troubleshooting SSL/TLS issues, security auditing, and understanding certificate properties.

Steps to Parse a Certificate:

  1. Obtain the certificate (from a file, website, or elsewhere)
  2. Paste the certificate into CyberChef's input pane (PEM or DER format)
  3. Add the "Parse X.509 certificate" operation
  4. View the parsed output showing all certificate fields
  5. Examine specific fields of interest (validity dates, subject, extensions)
Parsed Certificate Example Output
Version: 3 Serial Number: 4a:f7:21:3f:8c:b2:4e:19 Signature Algorithm: SHA256-RSA Issuer: Country (C): US Organization (O): Let's Encrypt Common Name (CN): R3 Validity: Not Before: 2024-01-15 00:00:00 UTC Not After: 2024-04-15 23:59:59 UTC Subject: Common Name (CN): example.com Subject Public Key Info: Algorithm: RSA Key Size: 2048 bits Public Key: 30:82:01:0a:02:82:01:01:00... Extensions: Key Usage: Digital Signature, Key Encipherment Extended Key Usage: TLS Web Server Authentication Subject Alternative Names: - example.com - www.example.com Authority Key Identifier: 14:2e:b3:17:b7... Subject Key Identifier: 3d:af:54:21:e8... Signature: 8a:7f:3e:21:9c:4b...

Common Use Cases

1. Verifying Certificate Details

Check that a certificate has the correct domain names, validity period, and issuer before deploying it to a web server.

2. Troubleshooting SSL/TLS Issues

When a website shows certificate errors, parse the certificate to identify problems like expired dates, wrong domain names, or untrusted issuers.

3. Security Auditing

Examine certificates for weak algorithms (MD5, SHA1), short key lengths (< 2048 bits RSA), or misconfigured extensions.

4. Certificate Renewal Tracking

Check expiration dates across multiple certificates to plan renewals and avoid service disruptions.

5. Understanding Certificate Chains

Parse intermediate and root CA certificates to understand the trust chain from end-entity certificate to trusted root.

6. Compliance Verification

Ensure certificates meet organizational or regulatory requirements (key size, validity period, approved CAs).

Important Certificate Fields Explained

Subject Alternative Names (SANs)

Modern certificates use SANs to list all domain names the certificate is valid for. A single certificate can secure multiple domains and subdomains.

Subject Alternative Names: DNS: example.com DNS: www.example.com DNS: mail.example.com DNS: *.api.example.com

Key Usage

Specifies what the certificate key can be used for:

Extended Key Usage

Further restricts certificate usage:

Authority Information Access (AIA)

URLs where the issuer's certificate and OCSP responder can be found for validation.

CRL Distribution Points

URLs where Certificate Revocation Lists can be downloaded to check if the certificate has been revoked.

Obtaining Certificates for Analysis

From a Website (Browser)

  1. Click the padlock icon in the address bar
  2. Click "Certificate" or "View Certificate"
  3. Export or copy the certificate in PEM format
  4. Paste into CyberChef for parsing

Using OpenSSL Command Line

# Get certificate from website openssl s_client -connect example.com:443 -showcerts # Extract just the certificate openssl s_client -connect example.com:443 2>/dev/null | \ openssl x509 -outform PEM # View certificate details (alternative to CyberChef) openssl x509 -in certificate.pem -text -noout

From a File

If you have a certificate file (.crt, .cer, .pem), simply read its contents and paste into CyberChef.

Certificate Validation and Trust

Chain of Trust

X.509 certificates work in a hierarchy:

  1. Root CA: Self-signed, trusted by operating system/browser
  2. Intermediate CA: Signed by root, signs end-entity certificates
  3. End-Entity Certificate: The actual certificate for a website/service

Validation Process

When validating a certificate, systems check:

Security Note: Parsing a certificate shows you its contents but doesn't validate its trustworthiness. A certificate could have valid structure but be issued by an untrusted CA, be expired, or be revoked. Always verify certificates through proper validation mechanisms.

Common Certificate Issues

Issue Description How to Identify
Expired Certificate Certificate past its "Not After" date Check validity period in parsed output
Not Yet Valid Current date before "Not Before" date Check validity period start date
Wrong Domain Certificate issued for different domain Check Subject CN and SANs
Self-Signed Issuer and subject are identical Compare issuer and subject DNs
Weak Signature Using deprecated algorithm (MD5, SHA1) Check signature algorithm field
Short Key Length RSA key < 2048 bits Check public key size
Missing SANs No Subject Alternative Names extension Check extensions list

Certificate Extensions Deep Dive

Critical vs Non-Critical

Extensions can be marked as critical or non-critical. If a system doesn't understand a critical extension, it must reject the certificate. Non-critical extensions can be safely ignored.

Common Extensions

CyberChef Recipe Ideas

Here are some useful recipe combinations involving certificate parsing:

Best Practices

For Certificate Deployment

For Certificate Analysis

Automation Tip: Many organizations automate certificate parsing and monitoring to track expiration dates, identify weak certificates, and ensure compliance. CyberChef can be part of this workflow for manual verification and troubleshooting.
← Back to Operations Guide