Skip to main content

easypki

Build a Private Certificate Authority (PKI).

Feature

  • Issuing a CA certificate
  • Issuing a server certificate
  • Issuing a client certificate
  • Issuing a pkcs12 file containing the client certificate and CA certificate
  • Issuance of CRL certificate

Setup

pip install easypki

How to use

Certificate creation

# module import
from easypki import pki

# make instance
private_pki = pki.BuildPKI()

# make ca cert
ca_cert, ca_key, ca_csr = private_pki.make_ca(
    country_name='JP',
    organization_name='Example Company',
    common_name='Private RootCA',
    cert_expire_days=36500
)

# make server cert
server_cert, server_key, server_csr = private_pki.make_server(
    ca_cert=ca_cert,
    ca_key=ca_key,
    common_name='example.com',
    san=['192.168.1.1', '*.example.com', 'example.net']
    cert_expire_days=365
)

# make client cert
client_cert, client_key, client_csr = private_pki.make_client(
    ca_cert=ca_cert,
    ca_key=ca_key,
    common_name='user name',
    email_address='admin@example.com',
    cert_expire_days=365
)

# make pkcs12 data
pkcs12 = private_pki.make_pkcs12(
    ca_cert=ca_cert,
    client_cert=client_cert,
    client_key=client_key
)

# make crl
crl_cert, crl_key = private_pki.make_crl(
    expire_cert=server_cert,
    expire_date=7,
    crl_cert=crl_cert,
    ca_cert=ca_cert,
)


# save file
# Please specify the stored variable and file name
with open('ca_cert.pem','wb') as f:
    f.write(ca_cert)

Variables output from the instance method are saved in pem data format, so they can be saved as they are.

The certificate is also stored in the instance variable. Therefore, you can also create it as follows.

    prvpki = pki.BuildPKI()
    ca_cert, ca_key, ca_csr = prvpki.make_ca(
        common_name='Private RootCA'
    )
    server_cert, server_key, server_csr = prvpki.make_server(
        common_name='example.com'
    )
    client_cert, client_key, client_csr = prvpki.make_client()

    pkcs12 = prvpki.make_pkcs12()

If you already have a CA certificate and CA key created It can also be created as follows.

    prvca = pki.BuildPKI()
    ca_cert, ca_key, ca_csr = prvca.make_ca(
        common_name='Private RootCA'
    )
    del prvca
    
    prvpki = pki.BuildPKI(
        ca_cert=ca_cert,
        ca_key=ca_key
    )
    server_cert, server_key, server_csr = prvpki.make_server(
        common_name='example.com'
    )
    client_cert, client_key, client_csr = prvpki.make_client()

    pkcs12 = prvpki.make_pkcs12()

Metadata

Release files for easypki 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easypki 0.0.1
File Size Uploaded
easypki-0.0.1.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easypki 0.0.1
File Interpreter ABI Platform
easypki-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / easypki-0.0.1.tar.gz

Download URL easypki-0.0.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3c9d6eb75b131a70417e641e974a25fac9e5a984c9d8bf39a592a46269506c92
BLAKE2b-256 checksum
How to use checksums
6c779ef483bd876f16e59f970a636814ff097f4b1f31ad75074eee2c68d980cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.6.8 Windows/10

Release files / easypki-0.0.1-py3-none-any.whl

Download URL easypki-0.0.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a536acc32292de12a6236a3acfb3e2af941af982ef673a4d1eff0a5f7f39080
BLAKE2b-256 checksum
How to use checksums
43fbcb981f554c444f3fdb372b5bfe2f2cfa6d9126d2c931e025f1a42c72288f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.6.8 Windows/10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page