Skip to main content

A Python library for managing SSL/TLS certificates with a focus on security and ease of use.

Project description

certpylot

certpylot is a Python library for managing SSL/TLS certificates with a focus on security and ease of use. It provides tools to fetch, inspect, and manipulate certificates, as well as generate and manage private keys and CSRs (Certificate Signing Requests).

Features

  • Fetch and inspect SSL/TLS certificates from files or remote servers
  • View certificate details: subject, issuer, validity, fingerprint, and more
  • Generate and export private keys
  • Create and export CSRs (Certificate Signing Requests)
  • Extension and fingerprint utilities
  • Simple, object-oriented API

Installation

Install via PyPI (if published):

pip install certpylot

Or install from source:

git clone https://github.com/ollie-galbraith/certpylot.git
cd certpylot
poetry install

Usage

Fetch and Inspect a Certificate from a URL

from certpylot import Certificate

cert = Certificate(url="https://jsonplaceholder.typicode.com")
info = cert.get()
print(info)

Load a Certificate from a File

cert = Certificate(path="path/to/cert.pem")
info = cert.get()
print(info)

Generate a Private Key

from certpylot import PrivateKey

key = PrivateKey()
key.generate()
key.export("private_key.pem")

Generate a CSR

from certpylot import Csr, PrivateKey

key = PrivateKey()
key.generate()
key.serialize()
csr = Csr()
csr.generate("example.com", key.serialized_key)
csr.export("csr.pem")

API Reference

Certificate

  • Certificate(path=..., url=..., port=443, certificate_type='pem')
  • get(path=None, url=None, port=443, certificate_type='pem')
  • subject()
  • issuer()
  • serial_number()
  • fingerprint()
  • thumbprint()
  • not_valid_before()
  • not_valid_after()
  • public_key()
  • extensions()
  • extension(extension_oid)
  • export(path)

PrivateKey

  • PrivateKey()
  • generate(key_size=4096)
  • export(path)
  • serialize()
  • load(path, password=None)

Csr

  • Csr()
  • generate(domains, serialized_private_key)
  • export(path)

Testing

Run the unit tests with:

pytest

License

This project is licensed under the GPL-3.0 License.

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.


Author: Oliver Galbraith
Project Home: https://github.com/ollie-galbraith/certpylot

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

certpylot-0.1.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

certpylot-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: certpylot-0.1.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1015-azure

File hashes

Hashes for certpylot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d53361d3984e09c9d69aad432ad8469520baaf8c309dbb1ccdbeb7852be079d1
MD5 082873e0377264a4f3423df0c8f7875e
BLAKE2b-256 707fa978a3b3c05d358871bd6cfddd3b6ce7a353447b64188e5836dfebe3ffc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: certpylot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1015-azure

File hashes

Hashes for certpylot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b940cc930c37ca00233cf3227d3e729d098c30b484e8b9deeeabfdb4b0b5943
MD5 f97b98d27f1ea5a6e72fb93d3020cea6
BLAKE2b-256 d9e922d2e4d4450b8210afd8ce1b21eee54815f349d05945511d3460b8657067

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