asn1cipher


Nameasn1cipher JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryA Python library for encrypting and decrypting ASN.1 encrypted content.
upload_time2025-10-23 14:51:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache-2.0
keywords asn1 encryption cryptography cms pkcs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](examples/basic_usage.py)

```python
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](https://github.com/wbond/asn1crypto) - ASN.1 parsing and serialization
- [cryptography](https://github.com/pyca/cryptography) - Python cryptography library

## Author

joseph@jc-lab.net

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "asn1cipher",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "asn1, encryption, cryptography, cms, pkcs",
    "author": null,
    "author_email": "Your Name <your.email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/20/1c/9267f70247d930bb02a9c8df4aa6b4c8cafc033d6c97ca2aa925a0575970/asn1cipher-0.0.3.tar.gz",
    "platform": null,
    "description": "# asn1cipher\n\nA Python library for encrypting and decrypting ASN.1 encrypted content. Uses `asn1crypto` library's `EncryptionAlgorithm` and `EncryptedContentInfo`.\n\n## Features\n\n**Algorithm Oid**\n\n- **PBES1** support (`1.2.840.113549.1.5.X`)\n- **PKCS#12** encryption support (`1.2.840.113549.1.12.1.X`)\n- **PBES2/PBKDF2** support (`1.2.840.113549.1.5.13`)\n\n**Cipher Algorithm**\n- **RC2** block cipher\n- **Custom Block Cipher Support** (BlockCipher abstraction)\n\n## Quick Start\n\n### Basic Usage\n\n[examples/basic_usage.py](examples/basic_usage.py)\n\n```python\nfrom asn1cipher import Provider\nfrom asn1crypto.algos import EncryptionAlgorithm, Pbes1Params\nfrom asn1crypto.core import OctetString\nimport os\n\n# Create Provider instance\nprovider = Provider()\n\n# Data to encrypt and password\nplaintext = b\"Hello, World! This is a secret message.\"\npassword = b\"my_secret_password\"\n\n# Configure PBES1 (SHA1 + DES) algorithm\nencryption_algorithm = EncryptionAlgorithm({\n    'algorithm': 'pbes1_sha1_des',\n    'parameters': Pbes1Params({\n        'salt': os.urandom(8),\n        'iterations': 10000,\n    })\n})\n\n# Encrypt\nencrypted_content_info = provider.encrypt(\n    plaintext=plaintext,\n    password=password,\n    encryption_algorithm=encryption_algorithm\n)\n\n# Decrypt\ndecrypted = provider.decrypt(\n    encrypted_content_info=encrypted_content_info,\n    password=password\n)\n\nassert decrypted == plaintext\nprint(\"\u2713 Encryption/decryption successful!\")\n```\n\n## License\n\nApache-2.0 License\n\n## Contributing\n\nContributions are welcome! Please submit a Pull Request.\n\n## Related Projects\n\n- [asn1crypto](https://github.com/wbond/asn1crypto) - ASN.1 parsing and serialization\n- [cryptography](https://github.com/pyca/cryptography) - Python cryptography library\n\n## Author\n\njoseph@jc-lab.net\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python library for encrypting and decrypting ASN.1 encrypted content.",
    "version": "0.0.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/jc-lab/asn1cipher/issues",
        "Documentation": "https://github.com/jc-lab/asn1cipher",
        "Homepage": "https://github.com/jc-lab/asn1cipher",
        "Repository": "https://github.com/jc-lab/asn1cipher"
    },
    "split_keywords": [
        "asn1",
        " encryption",
        " cryptography",
        " cms",
        " pkcs"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0e8d5ac12bea9169c84b1b63442845c3fc0ca18bde3e3d4fd52ff12fc3187362",
                "md5": "5b6b2d07dc666ef933d4feaffdd7f6de",
                "sha256": "ad22dd71bf274b88c3aadff357419aa66b094eb525e078225429bdeaa0b5b0df"
            },
            "downloads": -1,
            "filename": "asn1cipher-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b6b2d07dc666ef933d4feaffdd7f6de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17047,
            "upload_time": "2025-10-23T14:51:34",
            "upload_time_iso_8601": "2025-10-23T14:51:34.440535Z",
            "url": "https://files.pythonhosted.org/packages/0e/8d/5ac12bea9169c84b1b63442845c3fc0ca18bde3e3d4fd52ff12fc3187362/asn1cipher-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "201c9267f70247d930bb02a9c8df4aa6b4c8cafc033d6c97ca2aa925a0575970",
                "md5": "cf4a2cda4ace01a26a41700b80a85b27",
                "sha256": "23c592db613fe43c0940ff90e7a1ac023358b2d049ce8ea9075d8f72578a61a5"
            },
            "downloads": -1,
            "filename": "asn1cipher-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "cf4a2cda4ace01a26a41700b80a85b27",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15988,
            "upload_time": "2025-10-23T14:51:35",
            "upload_time_iso_8601": "2025-10-23T14:51:35.827168Z",
            "url": "https://files.pythonhosted.org/packages/20/1c/9267f70247d930bb02a9c8df4aa6b4c8cafc033d6c97ca2aa925a0575970/asn1cipher-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 14:51:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jc-lab",
    "github_project": "asn1cipher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "asn1cipher"
}
        
Elapsed time: 3.87377s