Skip to main content

Simpler certificate objects

Project description

Library that wraps around the cryptography library, aiming to simplify the loading and validation of certificates. Providing a more streamlined interface instead of delving into the intricacies of certificate operations.

Note that this project is still not meant for production-use scenarios, use it at your own risk.

Installation

This library is available on the python package index, you can install it like via pip

pip install cryptocerts

Contributing

Community contributes are welcome. Please use the Github issue tracker for any feature, requests or bugs you might encounter.

Usage

Loading a certificate

Easier loading a certificate without having to know which format it is

from cryptocerts import CertificateToken

# From a file
certificate = CertificateToken.load_from_file("filepath/mycert.crt")

# From bytes
certificate = CertificateToken(b"<certificate bytes>")

Validate a certificate with a custom certificate store

Validate that a certificate is valid up to a custom trusted root

from cryptocerts import (
    CertificateToken,
    CertificateValidator,
    CertificatesStore
)

my_trusted_roots : list[CertificateToken] = [ ... ]
my_intermediate_certificates : list[CertificateTokens] = [ ... ]
certificates_store = CertificatesStore(my_trusted_roots, my_intermediate_certificates)
certificate_validator = CertificateValidator(certificates_store)

# `result` contains validation info about the certificate, 
# f.x. a valid certificate
result = certificate_validator.verify_certificate(certificate)
result.validation_conclusion # ValidationStatus.VALID
result.valid_to_trusted_root # True
result.certificate_validation_result[0].certificate_token # <certificate>
result.certificate_validation_result[0].validation_errors # []

# and an invalid certificate
result = certificate_validator.verify_certificate(invalid_certificate)
result.validation_conclusion # ValidationStatus.INVALID
result.valid_to_trusted_root # True
result.certificate_validation_result[0].certificate_token # <invalid_certificate>
result.certificate_validation_result[0].validation_errors # [ValidatorErrors.EXPIRED]

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

cryptocerts-0.0.1a3.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

cryptocerts-0.0.1a3-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file cryptocerts-0.0.1a3.tar.gz.

File metadata

  • Download URL: cryptocerts-0.0.1a3.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for cryptocerts-0.0.1a3.tar.gz
Algorithm Hash digest
SHA256 c78d2eea21e7f294a2d70cffd92803149e921614e3168aabbd2b823e881107b4
MD5 2a49f1197eea49ce41ee3c267802caff
BLAKE2b-256 f210feb1b64aed7d51ab6844ede7fc2bd582921662c8b1a41d207ac679b08bf8

See more details on using hashes here.

File details

Details for the file cryptocerts-0.0.1a3-py3-none-any.whl.

File metadata

File hashes

Hashes for cryptocerts-0.0.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c156e45faf2bdd161e70892ca2f6ed002cefdc98a79f0c0e440fbde20441ee
MD5 76bc52e880a6c05c6d29a161dae21136
BLAKE2b-256 55aeab0206748c79615cf26f311d9e15576905d209b61e776e035a9c47156f9e

See more details on using hashes here.

Supported by

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