This project analyzes elliptic curve parameters from X.509 certificates that use ECDSA (Elliptic Curve Digital Signature Algorithm) for authentication.
Given a PEM-encoded certificate, the tool identifies the elliptic curve, extracts its parameters, and prints a human-readable summary.
Modern HTTPS websites often use Elliptic Curve Digital Signatures (EC-DSA) for authentication.
This tool:
- Reads a server certificate (
.crt/ PEM). - Detects which elliptic curve is used from its OID.
- Looks up the corresponding curve parameters.
- Prints the elliptic curve equation and prime field characteristic.
Supports NIST standard curves: P-256, P-384, P-521
- Parses PEM-encoded X.509 certificates
- Detects elliptic curve using OID bytes
- Prints:
- Curve name & OID
- Prime field
p - Curve parameters (
a,b) - Base point
(Gx, Gy) - Order
n, cofactorh - Security level (in bits)
- Python 3+
git clone https://github.com/yourusername/ec-certificate-analyzer.git
cd ec-certificate-analyzerpython ec_cert_analyzer.py path/to/certificate.crtExample:
python ec_cert_analyzer.py bits_certificate.crt-
Reads Certificate
- Opens
.crt/.pem, removes header/footer, Base64 decodes to DER format
- Opens
-
Extracts Curve OID
- Searches raw certificate bytes for known OID patterns such as
- P-256 →
2a 86 48 ce 3d 03 01 07 - P-384 →
2b 81 04 00 22 - P-521 →
2b 81 04 00 23
- P-256 →
- Searches raw certificate bytes for known OID patterns such as
-
Loads Pre-Stored Parameters
- Prime
p - Weierstrass form: [ y^2 = x^3 + ax + b \mod p ]
- Generator
(Gx, Gy), ordern, cofactorh, security bits
- Prime
-
Prints Analysis Report
- Curve name & standard
- Field type (prime field)
- Parameters in hex/decimal
- Fully formatted output for readability
ec-certificate-analyzer/
├─ ec_cert_analyzer.py # Main script
├─ certificate.crt # Example
└─ README.md
- Limited curves (currently P-256, P-384, P-521 only)
- No chain validation or signature verification
- OID scanning instead of full ASN.1 parsing
- Add Brainpool, Curve25519, Ed25519
- Full ASN.1 parser
- ECDSA signature verification
- PKCS#12 support
MIT
For educational use only — not a substitute for production-grade certificate validation.