Certipy: CA and Certificate Utility

0.2.2 · maintenance · verified Thu Apr 16

Certipy (version 0.2.2) is a Python utility designed to simplify the creation and signing of Certificate Authorities (CAs) and certificates on the fly. It wraps `pyOpenSSL` to manage certificate records, maintain signing hierarchies, and persist certificates to files. The project appears to be in a maintenance status, with its latest PyPI release in March 2025, though active development on GitHub seems to have slowed since early 2023.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize Certipy, create a root Certificate Authority, and then generate a signed certificate using that CA. It also includes cleanup for the temporary certificate store directory.

from certipy import Certipy
import os

# Create a temporary directory for the store
store_dir = os.path.join(os.getcwd(), 'cert_store')
os.makedirs(store_dir, exist_ok=True)

try:
    # Initialize Certipy with a store directory
    certipy_instance = Certipy(store_dir=store_dir)

    # Create a Certificate Authority (CA)
    ca_name = 'my_root_ca'
    certipy_instance.create_ca(ca_name)
    root_ca_record = certipy_instance.store.get_record(ca_name)
    print(f"Root CA '{ca_name}' created at: {root_ca_record.cert_path}")

    # Create and sign a key-certificate pair using the CA
    cert_name = 'my_server_cert'
    certipy_instance.create_signed_pair(cert_name, ca_name)
    server_cert_record = certipy_instance.store.get_record(cert_name)
    print(f"Signed certificate '{cert_name}' created at: {server_cert_record.cert_path}")

finally:
    # Clean up the temporary store directory
    if os.path.exists(store_dir):
        import shutil
        shutil.rmtree(store_dir)
        print(f"Cleaned up directory: {store_dir}")

view raw JSON →