Skip to main content

Python Certificate Manager

Module to assist in the programmatic management of PFX digital certificates on Windows operating system.

Working with A1 digital certificates (e-CPF and e-CNPJ), it is extremely common to need to install and remove them from operating system, or even obtain some information like expiration date or issuer of these objects. So this module was made for provide these operations programmatically and easily.

License Issues Version Last commit Testing Coverage

Table of content

Installing

pip install pycertmanager

Requirements

The module currently supports only Windows operating system and has been tested over Python >= 3.10.

Using

The main entity of the module is the Certificate class which provides the methods for manipulating certificates within the operating system and obtaining relevant information from them.

Examples

from pycertmanager import Certificate

# creating certificate object
certificate = Certificate("mycertificate.pfx", "123456")

# installing certificate on system
certificate.install()

# getting a list with certificate subject data
subject_data = certificate.get_subject_data()

# getting certificate expiration date
expiration_date = certificate.get_expiration_date()

# getting certificate expiration date
issue_date = certificate.get_issue_date()

# removing a certificate
# note that it is a class method and 'pycertmanager.test' is the
# Common Name (CN) of the certificate you want to remove
Certificate.remove("pycertmanager.test")

How does it works

In short, some methods (install and remove) calls PowerShell cmdlets through subprocess built-in module while the remaining methods uses cryptography package primitives.

Support

Found a problema? Please open an Issue describing it or a Pull Request if you know how to fix it. Make sure to write the tests from your code.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Reinforcing, make sure to write tests from your code.

Setup your environment (Windows PowerShell)

# clone this repository
git clone https://github.com/eldersantoss/pycertmanager.git

# create and activate virtual environment
cd pycertmanager
python -m venv venv
& venv/Scripts/Activate

# install dependencies
pip install -r requirements.txt

# run tests
python -m unittest

Roadmap

  • Implement Linux support: the intention is to make this module cross-platform.

License

This project is licensed under the terms of the MIT License.

Metadata

Release files for pycertmanager 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 pycertmanager 0.0.6
File Size Uploaded Provenance Actions
pycertmanager-0.0.6.tar.gz 5.1 kB Without provenance Details for pycertmanager-0.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 10.5 kB

Release files / pycertmanager-0.0.6.tar.gz

Download URL pycertmanager-0.0.6.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a3ac52eff4c6328b363a597848d550e1d7f44236ae39edcc81bb67bd8f3ec651
BLAKE2b-256 checksum
How to use checksums
c1c41fb9c8d77752c9ea7f147a7c2b9ae6b31004efa06b333ae4964a6f393c27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

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

Download URL pycertmanager-0.0.6-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35e6cc24582ee3d9d624caf2f8486304b6f038cc1b0c6c41bccc4a45efebacf6
BLAKE2b-256 checksum
How to use checksums
e22f03ff9c78a6ed8b5635901769882fbf92c22f8422af63ca72254b573f8c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Security for pycertmanager 0.0.6

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.

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