Skip to main content

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

examples/basic_usage.py

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.

Author

joseph@jc-lab.net

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)

Source distribution for asn1cipher 0.0.4
File Size Uploaded Provenance Actions
asn1cipher-0.0.4.tar.gz 16.2 kB With provenance Details for asn1cipher-0.0.4.tar.gz

Built distribution (wheel)

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

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 log

Release 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

Security for asn1cipher 0.0.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for asn1cipher-0.0.4.tar.gz

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

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