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"
)
Metadata
Release files for python-digital-certificate 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-digital-certificate-0.3.0.tar.gz | 3.8 kB | Without provenance | Details for python-digital-certificate-0.3.0.tar.gz |
Release files / python-digital-certificate-0.3.0.tar.gz
| Download URL | python-digital-certificate-0.3.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
173b13b84744ff3e74284f86af7720f4fd0827013c990d356d7072ea15312665
|
|
BLAKE2b-256 checksum How to use checksums |
a855c2256d7d21d89e3b671f9f0f9272ee688f4b4539780686d172d2525c5856
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.3
|
Security for python-digital-certificate 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.