asn1cipher
A Python library for encrypting and decrypting ASN.1 encrypted content. Uses asn1crypto library's EncryptionAlgorithm and EncryptedContentInfo.
Features
Algorithm Oid
- PBES1 support (
1.2.840.113549.1.5.X) - PKCS#12 encryption support (
1.2.840.113549.1.12.1.X) - PBES2/PBKDF2 support (
1.2.840.113549.1.5.13)
Cipher Algorithm
- RC2 block cipher
- Custom Block Cipher Support (BlockCipher abstraction)
Quick Start
Basic Usage
from asn1cipher import Provider
from asn1crypto.algos import EncryptionAlgorithm, Pbes1Params
from asn1crypto.core import OctetString
import os
# Create Provider instance
provider = Provider()
# Data to encrypt and password
plaintext = b"Hello, World! This is a secret message."
password = b"my_secret_password"
# Configure PBES1 (SHA1 + DES) algorithm
encryption_algorithm = EncryptionAlgorithm({
'algorithm': 'pbes1_sha1_des',
'parameters': Pbes1Params({
'salt': os.urandom(8),
'iterations': 10000,
})
})
# Encrypt
encrypted_content_info = provider.encrypt(
plaintext=plaintext,
password=password,
encryption_algorithm=encryption_algorithm
)
# Decrypt
decrypted = provider.decrypt(
encrypted_content_info=encrypted_content_info,
password=password
)
assert decrypted == plaintext
print("✓ Encryption/decryption successful!")
License
Apache-2.0 License
Contributing
Contributions are welcome! Please submit a Pull Request.
Related Projects
- asn1crypto - ASN.1 parsing and serialization
- cryptography - Python cryptography library
Author
Metadata
Release files for asn1cipher 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asn1cipher-0.0.4.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asn1cipher-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.8 kB
Release files / asn1cipher-0.0.4.tar.gz
| Download URL | asn1cipher-0.0.4.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adb44447659c5aabc0f004efeeaed7a961f30a81f2ae996ae55afc877bcdb1f7
|
|
BLAKE2b-256 checksum How to use checksums |
a456cccc42bac878245eb2459874a76acc0dcccfddf0f66dd94675bedbe37131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.
Transparency logRelease files / asn1cipher-0.0.4-py3-none-any.whl
| Download URL | asn1cipher-0.0.4-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcc948d54c97f22366cb16ff9888b53f933256292fe590e8c8e4527879a268d8
|
|
BLAKE2b-256 checksum How to use checksums |
0375d4a0f0f320877ab9b4a93faebd1b567f3f36b1b092bd4712544103366379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.
Transparency log