Skip to main content

A Python package to analyze SSL certificates

Project description

SSL Analyzer

PyPI version
A Python-based SSL/TLS certificate analysis tool that retrieves detailed information about SSL certificates, including expiration, issuer, key details, and security attributes.


🔹 Features

👉 Extracts SSL/TLS version and cipher suite details
👉 Retrieves certificate issuer, subject, validity period
👉 Detects OCSP Must-Staple & self-signed certificates
👉 Analyzes public key strength (RSA, ECC, DSA)
👉 Extracts Subject Alternative Names (SAN)
👉 Calculates SHA-1 & SHA-256 fingerprints
👉 Supports CLI and JSON-formatted output


📛 Installation

Install the package via pip:

pip install ssl-analyzer

🚀 Usage

You can use ssl-analyzer via CLI or as a Python module.

🔹 CLI Usage

ssl-analyzer example.com

🔹 Output in JSON Format

ssl-analyzer example.com --json

🔹 As a Python Module

You can also use it programmatically:

from ssl_analyzer import SSLAnalyzer

analyzer = SSLAnalyzer("example.com")
ssl_details = analyzer.analyze()
print(ssl_details)

📚 Example Output

🔹 Default CLI Output

SSL CERTIFICATE ANALYZER
========================

----------------------------------------
ISSUER
----------------------------------------
Common Name = DigiCert Global G3 TLS ECC SHA384 2020 CA1
Organization = DigiCert Inc
Country = US
State / Province = N/A
Locality = N/A

----------------------------------------
SUBJECT
----------------------------------------
Common Name = *.example.com
Organization = Internet Corporation for Assigned Names and Numbers
Country = US
State / Province = California
Locality = Los Angeles

----------------------------------------
SERIAL NUMBER
----------------------------------------
14416812407440461216471976375640436634

----------------------------------------
VERSION
----------------------------------------
v3

----------------------------------------
VALID FROM
----------------------------------------
2025-01-15T00:00:00+00:00

----------------------------------------
VALID UNTIL
----------------------------------------
2026-01-15T23:59:59+00:00

----------------------------------------
SIGNATURE ALGORITHM
----------------------------------------
sha384

----------------------------------------
SAN
----------------------------------------
*.example.com
example.com

----------------------------------------
PUBLIC KEY
----------------------------------------
Key Type = ECPublicKey
Key Size = 256
PEM Public Key = 
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmkiXhC1hbAjJahSgyDiA5gDAh/qZ
Vw4bAOLYh5JX5wj7PF6w04QoN8EkEY7TIHF0vZOPTgkDzgI7sORmc8+v7g==
-----END PUBLIC KEY-----

Curve = secp256r1
X Coordinate = 6978443739...
Y Coordinate = 1136371893...
Key Algorithm = Elliptic Curve (ECC)
Supported Key Uses = ['Digital Signature', 'Key Agreement']
Weak Key Check = Key appears strong

----------------------------------------
KEY USAGE
----------------------------------------
digital_signature = True
content_commitment = False
key_encipherment = False
data_encipherment = False
key_agreement = True
key_cert_sign = False
crl_sign = False
encipher_only = False
decipher_only = False


----------------------------------------
EXTENDED KEY USAGE
----------------------------------------
1.3.6.1.5.5.7.3.1
1.3.6.1.5.5.7.3.2

----------------------------------------
OCSP MUST-STAPLE
----------------------------------------
False

----------------------------------------
SELF-SIGNED
----------------------------------------
False

----------------------------------------
SHA-1 FINGERPRINT
----------------------------------------
N/A

----------------------------------------
SHA-256 FINGERPRINT
----------------------------------------
N/A

🔹 JSON Output

{
    "Issuer": {
        "Common Name": "DigiCert Global G3 TLS ECC SHA384 2020 CA1",
        "Organization": "DigiCert Inc",
        "Country": "US",
        "State / Province": "N/A",
        "Locality": "N/A"
    },
    "Subject": {
        "Common Name": "*.example.com",
        "Organization": "Internet Corporation for Assigned Names and Numbers",
        "Country": "US",
        "State / Province": "California",
        "Locality": "Los Angeles"
    },
    "Serial Number": 14416812407440461216471976375640436634,
    "Version": "v3",
    "Valid From": "2025-01-15T00:00:00+00:00",
    "Valid Until": "2026-01-15T23:59:59+00:00",
    "Signature Algorithm": "sha384",
    "SAN": [
        "*.example.com",
        "example.com"
    ],
    "Public Key": {
        "Key Type": "ECPublicKey",
        "Key Size": 256,
        "PEM Public Key": "\n-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmkiXhC1hbAjJahSgyDiA5gDAh/qZ\nVw4bAOLYh5JX5wj7PF6w04QoN8EkEY7TIHF0vZOPTgkDzgI7sORmc8+v7g==\n-----END PUBLIC KEY-----\n",
        "Curve": "secp256r1",
        "X Coordinate": "6978443739...",
        "Y Coordinate": "1136371893...",
        "Key Algorithm": "Elliptic Curve (ECC)",
        "Supported Key Uses": [
            "Digital Signature",
            "Key Agreement"
        ],
        "Weak Key Check": "Key appears strong"
    },
    "Key Usage": {
        "digital_signature": true,
        "content_commitment": false,
        "key_encipherment": false,
        "data_encipherment": false,
        "key_agreement": true,
        "key_cert_sign": false,
        "crl_sign": false,
        "encipher_only": false,
        "decipher_only": false
    },
    "Extended Key Usage": [
        "1.3.6.1.5.5.7.3.1",
        "1.3.6.1.5.5.7.3.2"
    ],
    "OCSP Must-Staple": false,
    "Self-Signed": false,
    "SHA-1 Fingerprint": "N/A",
    "SHA-256 Fingerprint": "N/A"
}

🛠️ Development & Contribution

🔹 Clone the Repository

git clone https://github.com/yourusername/ssl-analyzer.git
cd ssl-analyzer
pip install -r requirements.txt

🔹 Run Tests

pytest tests/

🔹 Contribute

  • Open an issue for bugs/feature requests
  • Submit a pull request with improvements

💌 License

This project is licensed under the MIT License.


🔗 Links


This README.md ensures clarity, professionalism, and usability. Let me know if you want any modifications! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssl_analyzer-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssl_analyzer-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file ssl_analyzer-0.1.1.tar.gz.

File metadata

  • Download URL: ssl_analyzer-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for ssl_analyzer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fa13a80c766ec86e032e0c498061ca32ec39af7bc113440193ab67b9b6b36944
MD5 aad1bbcbc45cb9adb0964359fe93ebce
BLAKE2b-256 1e6116bb59ac0de5c1d1ace78d7f469093b79061fb7a8dec4fac36694062547e

See more details on using hashes here.

File details

Details for the file ssl_analyzer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ssl_analyzer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for ssl_analyzer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b97efaf4f35f6a4dcfe408224d304a0dff948ae73279e1a070869ac713de7ceb
MD5 799950600e74fbcd8faa986392905a26
BLAKE2b-256 aa47fc31d74b7433c535821f87036c315437c3a5d652cf8e6791f8a5f58b5d73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page