Python library for signing x509 using keys in an pkcs11 device such as a HSM
Project description
python_x509_pkcs11
Seamless signing x509 using PKCS11 device for key storage
Currently supports
- Creating a root CA and generating its RSA key in the PKCS11 device
- Using the key in the PKCS11 device to sign certificates (or Intermediate CAs)
- Creating CRLs with the PKCS11 device key
- Store multiple keys in the PKCS11 device enabling a full PKI infrastructure
- 'Advanced' handling of fragile persistent PKCS11 sessions, including recreating the session if PKCS11 operation timeout
This package is pretty much a wrapper around python-pkcs11 and asn1crypto
Setup
# Install this package
pip install python_x509_pkcs11
# Install deps and add your user to the softhsm group
sudo apt-get install opensc softhsm2
sudo usermod -a -G softhsm $USER
sudo reboot # Yeah seem to not update your groups without a reboot
# export env values the code will use
export PKCS11_MODULE="/usr/lib/softhsm/libsofthsm2.so"
export PKCS11_PIN="1234"
export PKCS11_TOKEN="my_test_token_1"
# Initialize the token
softhsm2-util --init-token --slot 0 --label $PKCS11_TOKEN --pin $PKCS11_PIN --so-pin $PKCS11_PIN
Usage
Look at the documentation for quick examples to begin.
The tests are also a good starting point
Contributing / Tests
# Make your code changes
# Then in the root folder, where this README is
bash dev-run.sh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_x509_pkcs11-0.1.83.tar.gz
(13.9 kB
view details)
Built Distribution
File details
Details for the file python_x509_pkcs11-0.1.83.tar.gz
.
File metadata
- Download URL: python_x509_pkcs11-0.1.83.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccc6e27efa236f2705432857ef9a97b13adb0b97322a2f95ba0d7fb27055425b |
|
MD5 | 0cf12874594ad5eb51b58f665df58461 |
|
BLAKE2b-256 | 665ea45206c4bbbc5809c141ceffb71a5c6af5851b37dffacfd84ff561c2050b |
File details
Details for the file python_x509_pkcs11-0.1.83-py3-none-any.whl
.
File metadata
- Download URL: python_x509_pkcs11-0.1.83-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a57031c995698605252e438ae98ae7ef4142d65d38c872d5a629f7c96abe750d |
|
MD5 | 41f7b7379138157ba2b0ce01a22cf89a |
|
BLAKE2b-256 | 1135da781977999ea681dd3c5f239fe18ab7666ed3114900fad16cbe83479711 |