Skip to main content

simplepki

Simple Public Key Infrastructure intends to provide most of the components needed to manage a PKI. (With a few missing tools as of right now)

CLI

Get the CLI: pip install simplepki

You can pass --pass to most of these and it will ask for a passphrase to use to protect the key

Create the root CA:

# You can also pass the following through arguments if you do not want to use env variables.
export SP_ROOT=/tmp/simplepki
export SP_CA=root
export SP_CN="Acme Inc. - Root CA"
export SP_ORGANIZATION="Acme Inc."
export SP_ORGANIZATIONAL_UNIT=IT
export SP_COUNTRY=US
export SP_LOCALITY="Agloe"
export SP_PROVINCE="New York"

mkdir $SP_ROOT
simplepki create root

Create a server certificate for blog.acme.com and www.acme.com:

# You can also pass the following through arguments if you do not want to use env variables.
export SP_ROOT=/tmp/simplepki
export SP_CA=root
export SP_ORGANIZATION="Acme Inc."
export SP_ORGANIZATIONAL_UNIT=IT
export SP_COUNTRY=US
export SP_LOCALITY="Agloe"
export SP_PROVINCE="New York"

simplepki create cert www.acme.com --dns blog.acme.com --dns www.acme.com

Create an intermediate CA:

# You can also pass the following through arguments if you do not want to use env variables.
export SP_ROOT=/tmp/simplepki
export SP_CA=root
export SP_CN="Acme Inc. - Internal CA"
export SP_INTERMEDIATE=intermedaite
export SP_ORGANIZATION="Acme Inc."
export SP_ORGANIZATIONAL_UNIT=IT
export SP_COUNTRY=US
export SP_LOCALITY="Agloe"
export SP_PROVINCE="New York"

simplepki create intermediate

Create a wildcard certificate for internal use, signed by the intermediate ca:

# You can also pass the following through arguments if you do not want to use env variables.
export SP_ROOT=/tmp/simplepki
export SP_CA=intermediate
export SP_ORGANIZATION="Acme Inc."
export SP_ORGANIZATIONAL_UNIT=IT
export SP_COUNTRY=US
export SP_LOCALITY="Agloe"
export SP_PROVINCE="New York"

simplepki create cert *.internal.acme.com --dns *.internal.acme.com

After running all the commands above you will end up with this

/tmp/simplepki/
├── [drwxrwxr-x]  intermediate
│   ├── [drwxrwxr-x]  certs
│   │   ├── [-rw-r--r--]  root.cert.pem
│   │   └── [-rw-r--r--]  wildcard_.internal.acme.com.cert.pem
│   └── [drwx------]  private
│       ├── [-r--------]  root.key.pem
│       └── [-r--------]  wildcard_.internal.acme.com.key.pem
└── [drwxrwxr-x]  root
    ├── [drwxrwxr-x]  certs
    │   ├── [-rw-r--r--]  root.cert.pem
    │   └── [-rw-r--r--]  www.acme.com.cert.pem
    └── [drwx------]  private
        ├── [-r--------]  root.key.pem
        └── [-r--------]  www.acme.com.key.pem

You will find the generated certificates in $SP_ROOT/ca_name/certs/ and private keys in $SP_ROOT/ca_name/private/

For more info about available flags, checkout out the help simplepki -h.

Contributions

Contributions are welcome. Currently we have a few features missing that we would like to add

  • client certificate
  • publish crl
  • sign csr with selected ca
  • create csr
  • that index.txt log file
  • crlnumber file
  • serial file

Disclaimer

This is based on the https://github.com/google/easypki which is written in golang

Metadata

Release files for simplepki 0.0.6

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

Source distribution (sdist)

Source distribution for simplepki 0.0.6
File Size Uploaded
simplepki-0.0.6.tar.gz 6.1 kB Details

Built distribution (wheel)

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

Total release size: 13.1 kB

Release files / simplepki-0.0.6.tar.gz

Download URL simplepki-0.0.6.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d39d08dabb08d71e5d4b95bb05fb160d76fa06df38e8614a0f72e1e66429aaba
BLAKE2b-256 checksum
How to use checksums
6a12bcabc3822182d09543922c1bb7032b713d03babe6caf26882303fd74d754
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Release files / simplepki-0.0.6-py3-none-any.whl

Download URL simplepki-0.0.6-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d511de3a21abc43d61a332df3fbcc14a9bc7392745001d499cbfd8b2ca9018e8
BLAKE2b-256 checksum
How to use checksums
2b8ec5c2ada9872f9baf2f4e565fe0fb4ef70f6d893771dc668890a1bac3ce74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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