A Python tool for downloading, validating, and saving SSL certificate chains from domains.
- Downloads complete SSL certificate chains from domains
- Validates certificate chain integrity
- Checks certificate date validity
- Verifies basic constraints
- Saves certificate chains in PEM format
- Supports custom port specification
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
Basic usage:
python get_cert.py uwaterloo.ca
With custom port:
python get_cert.py uwaterloo.ca --port 8443
The script will:
- Fetch the certificate chain
- Validate the certificates
- Display validation results
- Save the certificate chain to
certs/domain-chain.pem
Example output:
Fetching certificate chain for uwaterloo.ca:443...
Validation Results for uwaterloo.ca:
------------------------------------------------------------
✓ Date Validity:
Valid from 2024-01-01 00:00:00 to 2025-01-01 00:00:00
✓ Basic Constraints:
Certificate extensions are present
✓ Chain of Trust:
Certificate chain validates successfully
------------------------------------------------------------
Certificate chain saved to: certs/example.com-chain.pem
Number of certificates in chain: 3
- Python 3.6+
- pyOpenSSL
.
├── README.md
├── requirements.txt
├── get_cert.py
└── certs/ # Created automatically when saving certificates
└── *.pem # Certificate chain files