Skip to main content

Python Package for managing keys, request SSL certificates from ACME.

Project description

CertApi

CertApi is a Python package for requesting SSL certificates from ACME. This is to be used as a base library for building other tools, or to integrate Certificate creation feature in you app.

⚠️ Warning: This project is in beta. Please stay tuned for the LTS v1.0.0 release.

For a detailed list of changes, please refer to the CHANGELOG.md.

Installation

You can install CertApi using pip

pip install certapi

Example: Obtain Certificate with Cloudflare

import json
from certapi import CertApiException, CloudflareChallengeSolver, Key, AcmeCertIssuer


# Initialize the Cloudflare challenge solver
# The API key is read from the CLOUDFLARE_API_KEY environment variable, or you can set it below.
challenge_solver = CloudflareChallengeSolver(api_key=None)

## initialize cert issuer with a new account key
cert_issuer = AcmeCertIssuer(Key.generate('rsa'), challenge_solver)

# Preform setup i.e. fetching directory and registering ACME account
cert_issuer.setup()

try:
    # Obtain a certificate for your domain
    (key, cert) = cert_issuer.generate_key_and_cert_for_domain("your-domain.com")

    print("------ Private Key -----")
    print(key.to_pem())
    print("------- Certificate ------")
    print(cert)
except CertApiException as e:
    print(f"An error occurred:", json.dumps(e.json_obj(), indent=2))

Example: Use High Leve API

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

certapi-0.5.1.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

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

certapi-0.5.1-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file certapi-0.5.1.tar.gz.

File metadata

  • Download URL: certapi-0.5.1.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for certapi-0.5.1.tar.gz
Algorithm Hash digest
SHA256 19963ee04d57b6beaffac96ff72613caea636631960104c5ba429248f5b028ea
MD5 de0c122ca81a9cc702582012a63ce964
BLAKE2b-256 29cc3e68b21c6c8130a5e81aaabcd097da692502e033620af0970d75729b381e

See more details on using hashes here.

File details

Details for the file certapi-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: certapi-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for certapi-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07d2d00744d0e97b700cbd43ca5f43d351552879595c85ad0833151e1d0113c8
MD5 529b4065aed0371ab0e1045151fdec50
BLAKE2b-256 db010664eb963c849de0d4064758aad62fbee0b8cef95df8dd550f41c92694ba

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