Read digital certificate (pfx and p12 files) in Python
Project description
Read digital certificate (pfx and p12 files) in Python
Install
From source:
$ python setup.py install
From PyPi:
$ pip install python-digital-certificate
Development
Create virtual environment
$ virtualenv .venv
$ source .venv/bin/activate
Install Dependencies
$ pip install .
Tests
Run
$ python -m unittest
Using
The package can be used with the pfx or p12 file, being the pfx file path or the binary file content
from digital_certificate.cert import Certificate
# Instantiate the class with the file path or the binary file content
_cert = Certificate(
pfx_file="./pfx-files/test_file.pfx",
password=b"123456"
)
# Read PFX file
_cert.read_pfx_file()
# Get Serial Number
print(_cert.serial_number())
# Get not valid before date
print(_cert.not_valid_before())
# Get not valid after date
print(_cert.not_valid_after())
# Get subject name
print(_cert.subject())
# Get owner name
print(_cert.common_name())
# Get Issuer name
print(_cert.issuer())
Using the binary content
If one already have the file in memory, the package can be used instantiating the class as following
_cert = Certificate(
pfx_file=binary_file_content,
password=b"123456"
)
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
Close
Hashes for python-digital-certificate-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 173b13b84744ff3e74284f86af7720f4fd0827013c990d356d7072ea15312665 |
|
MD5 | 482a94ed3f0159d03602ad42b056dbd5 |
|
BLAKE2b-256 | a855c2256d7d21d89e3b671f9f0f9272ee688f4b4539780686d172d2525c5856 |