TLS & Certificates Skill
A skill for working with X.509 certificates, parsing certificate data, converting between formats, and identifying common security issues.
When to use this skill
Use this skill when the user:
- Needs to parse or inspect a certificate file
- Wants to convert between certificate formats (PEM, DER, PKCS#7, PKCS#12)
- Is investigating certificate-related security issues
- Needs to understand certificate fields and their meaning
- Is working with TLS/SSL configurations
- Wants to check certificate validity or trust chains
Quick certificate parsing
To inspect a certificate, use these commands:
# Full certificate details
openssl x509 -in cert.pem -noout -text
# ASN.1 structure parsing
openssl asn1parse -in cert.pem
Key fields to inspect
When analyzing a certificate, always check these fields:
| Field |
What to look for |
| Subject / Issuer |
Who issued it? Is it self-signed? |
| SAN (Subject Alternative Names) |
What domains/IPs does it cover? |
| Key Usage / EKU |
What operations is it allowed to perform? |
| Basic Constraints |
Is it a CA certificate? (CA:TRUE) |
| Validity window |
NotBefore/NotAfter - is it expired or not yet valid? |
| Signature algorithm |
MD5/SHA1 are weak and deprecated |
Certificate formats
PEM
- Base64-encoded with
-----BEGIN CERTIFICATE----- headers
- Text format, human-readable
- Common extensions:
.pem, .crt, .cer
DER
- Binary ASN.1 encoding
- Smaller than PEM, not human-readable
- Common extension:
.der
PKCS#7 (.p7b)
- Certificate chain (multiple certificates)
- Does NOT include private key
- Used for distributing certificate chains
PKCS#12 (.pfx, .p12)
- Certificate + private key + chain
- Password-protected
- Used for importing/exporting certificates with keys
Format conversions
PEM to DER
openssl x509 -in cert.pem -outform DER -out cert.der
DER to PEM
openssl x509 -in cert.der -inform DER -outform PEM -out cert.pem
PKCS#12 to PEM (extract cert and key)
openssl pkcs12 -in file.pfx -out out.pem -nodes
PKCS#7 to PEM (extract certificates)
openssl pkcs7 -in file.p7b -print_certs -out certs.pem
Convert .cer to PEM
openssl x509 -in cert.cer -outform PEM -out cert.pem
Common security issues to check
When reviewing certificates, look for these red flags:
1. Weak signature algorithms
- MD5: Completely broken, never use
- SHA1: Deprecated, avoid
- SHA256+: Current standard
2. Missing chain validation
- Certificate should chain to a trusted root
- Self-signed certificates need explicit trust
- Check if intermediate CAs are present
3. Name constraint violations
- SAN should match the intended domain
- Wildcard certificates (
*.example.com) only match one subdomain level
- Implementation-specific parsing bugs may exist
4. Confused deputy issues
- Client certificate authentication may be misbound
- Ensure the certificate is actually being used for authentication
- Check for proper binding between certificate and session
5. Basic constraints issues
- End-entity certificates should have
CA:FALSE
- CA certificates should have
CA:TRUE and proper path length constraints
Certificate transparency
Check if a certificate has been logged in CT logs:
- Visit crt.sh and search by domain
- This shows all certificates ever issued for a domain
- Useful for detecting unauthorized certificate issuance
Example workflow
User: "I have this certificate file and need to understand what it's for"
You should:
- Parse the certificate with
openssl x509 -in cert.pem -noout -text
- Extract and explain the key fields (Subject, Issuer, SAN, Validity, Key Usage)
- Check for any security concerns (weak algorithms, expired, self-signed)
- Suggest next steps based on the findings
User: "Convert this .pfx file to something I can use"
You should:
- Ask if they need the private key extracted
- Use
openssl pkcs12 -in file.pfx -out out.pem -nodes to extract
- Explain the output (separate cert and key files)
- Remind them to protect the private key
Tools you'll need
openssl - Required for all certificate operations
openssl version 1.1.1 or 3.x recommended for full feature support
Common pitfalls
- File format confusion: If a command fails, try specifying
-inform DER or -inform PEM explicitly
- PKCS#12 passwords: You'll be prompted for the import password
- Private key protection: Never share private keys; use
-nodes only when you need the unencrypted key
- Chain order: When building chains, order matters (leaf cert first, then intermediates, then root)
1---2name: tls-certificates3description: Parse, analyze, and convert X.509 certificates and TLS-related files. Use this skill whenever the user mentions certificates, TLS, SSL, X.509, PEM, DER, PKCS#12, PKCS#7, certificate parsing, certificate validation, or anything related to cryptographic certificates and trust chains. Also use when users need to inspect certificate fields, convert between formats, or understand certificate security issues.4---56# TLS & Certificates Skill78A skill for working with X.509 certificates, parsing certificate data, converting between formats, and identifying common security issues.910## When to use this skill1112Use this skill when the user:13- Needs to parse or inspect a certificate file14- Wants to convert between certificate formats (PEM, DER, PKCS#7, PKCS#12)15- Is investigating certificate-related security issues16- Needs to understand certificate fields and their meaning17- Is working with TLS/SSL configurations18- Wants to check certificate validity or trust chains1920## Quick certificate parsing2122To inspect a certificate, use these commands:2324```bash25# Full certificate details26openssl x509 -in cert.pem -noout -text2728# ASN.1 structure parsing29openssl asn1parse -in cert.pem30```3132### Key fields to inspect3334When analyzing a certificate, always check these fields:3536| Field | What to look for |37|-------|------------------|38| **Subject / Issuer** | Who issued it? Is it self-signed? |39| **SAN (Subject Alternative Names)** | What domains/IPs does it cover? |40| **Key Usage / EKU** | What operations is it allowed to perform? |41| **Basic Constraints** | Is it a CA certificate? (CA:TRUE) |42| **Validity window** | NotBefore/NotAfter - is it expired or not yet valid? |43| **Signature algorithm** | MD5/SHA1 are weak and deprecated |4445## Certificate formats4647### PEM48- Base64-encoded with `-----BEGIN CERTIFICATE-----` headers49- Text format, human-readable50- Common extensions: `.pem`, `.crt`, `.cer`5152### DER53- Binary ASN.1 encoding54- Smaller than PEM, not human-readable55- Common extension: `.der`5657### PKCS#7 (`.p7b`)58- Certificate chain (multiple certificates)59- Does NOT include private key60- Used for distributing certificate chains6162### PKCS#12 (`.pfx`, `.p12`)63- Certificate + private key + chain64- Password-protected65- Used for importing/exporting certificates with keys6667## Format conversions6869### PEM to DER70```bash71openssl x509 -in cert.pem -outform DER -out cert.der72```7374### DER to PEM75```bash76openssl x509 -in cert.der -inform DER -outform PEM -out cert.pem77```7879### PKCS#12 to PEM (extract cert and key)80```bash81openssl pkcs12 -in file.pfx -out out.pem -nodes82```8384### PKCS#7 to PEM (extract certificates)85```bash86openssl pkcs7 -in file.p7b -print_certs -out certs.pem87```8889### Convert .cer to PEM90```bash91openssl x509 -in cert.cer -outform PEM -out cert.pem92```9394## Common security issues to check9596When reviewing certificates, look for these red flags:9798### 1. Weak signature algorithms99- **MD5**: Completely broken, never use100- **SHA1**: Deprecated, avoid101- **SHA256+**: Current standard102103### 2. Missing chain validation104- Certificate should chain to a trusted root105- Self-signed certificates need explicit trust106- Check if intermediate CAs are present107108### 3. Name constraint violations109- SAN should match the intended domain110- Wildcard certificates (`*.example.com`) only match one subdomain level111- Implementation-specific parsing bugs may exist112113### 4. Confused deputy issues114- Client certificate authentication may be misbound115- Ensure the certificate is actually being used for authentication116- Check for proper binding between certificate and session117118### 5. Basic constraints issues119- End-entity certificates should have `CA:FALSE`120- CA certificates should have `CA:TRUE` and proper path length constraints121122## Certificate transparency123124Check if a certificate has been logged in CT logs:125- Visit [crt.sh](https://crt.sh/) and search by domain126- This shows all certificates ever issued for a domain127- Useful for detecting unauthorized certificate issuance128129## Example workflow130131**User**: "I have this certificate file and need to understand what it's for"132133**You should**:1341. Parse the certificate with `openssl x509 -in cert.pem -noout -text`1352. Extract and explain the key fields (Subject, Issuer, SAN, Validity, Key Usage)1363. Check for any security concerns (weak algorithms, expired, self-signed)1374. Suggest next steps based on the findings138139**User**: "Convert this .pfx file to something I can use"140141**You should**:1421. Ask if they need the private key extracted1432. Use `openssl pkcs12 -in file.pfx -out out.pem -nodes` to extract1443. Explain the output (separate cert and key files)1454. Remind them to protect the private key146147## Tools you'll need148149- `openssl` - Required for all certificate operations150- `openssl` version 1.1.1 or 3.x recommended for full feature support151152## Common pitfalls1531541. **File format confusion**: If a command fails, try specifying `-inform DER` or `-inform PEM` explicitly1552. **PKCS#12 passwords**: You'll be prompted for the import password1563. **Private key protection**: Never share private keys; use `-nodes` only when you need the unencrypted key1574. **Chain order**: When building chains, order matters (leaf cert first, then intermediates, then root)