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.

Installation

You can install CertApi using pip

pip install certapi

Use Low level API

import json
import os
from certapi import FileSystemKeyStore, CertApiException, CloudflareChallengeSolver, AcmeCertManager, AcmeCertIssuer


# Initialize the key store and create acme account key
key_store = FileSystemKeyStore("data")

acme_key = key_store._get_or_generate_key("acme_account", "rsa")[0]

# 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
cert_issuer = AcmeCertIssuer(acme_key, challenge_solver)

# Setup 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))

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.4.6.tar.gz (30.5 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.4.6-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: certapi-0.4.6.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for certapi-0.4.6.tar.gz
Algorithm Hash digest
SHA256 2f8f8db65b62646b2de6bc7653ace96215ef0c25b5855ade44210c211b8b96ec
MD5 f3e987d6b9757fbcbee6925c2c693f6f
BLAKE2b-256 f57429bc0918e4dc17d88aafa3bb3b20207badcfc526eaa12a11533edfa1f2c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: certapi-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for certapi-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 daf64778b0afd2212039a69125b76cbc595daefcd2235b58fc0726f5c0b20a29
MD5 a324dac77192595f02e37aaa4416cd5b
BLAKE2b-256 341d78b172d19a77425694f6a1819b1d991062e83e8d8783eff4b80900965803

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