fips203


Namefips203 JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryML-KEM (FIPS203) -- asymmetric, quantum-secure encryption (Initial Public Draft)
upload_time2024-06-12 22:13:09
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords cryptography encryption fips fips203 kem lattice module-lattice post-quantum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `fips203` Python module

This Python module provides an implementation of FIPS 203, the
Module-Lattice-based Key Encapsulation Mechanism Standard.

The underlying mechanism is intended to offer "post-quantum"
asymmetric encryption and decryption.

## Example

The following example shows using the standard ML-KEM algorithm to
produce identical 32-byte shared secrets:

```
from fips203 import ML_KEM_512

(encapsulation_key, decapsulation_key) = ML_KEM_512.keygen()
(ciphertext, shared_secret_1) = encapsulation_key.encaps()
shared_secret_2 = decapsulation_key.decaps(ciphertext)
assert(shared_secret_1 == shared_secret_2)
```

Encapsulation keys, decapsulation keys, and ciphertexts can all be
serialized by accessing them as `bytes`, and deserialized by
initializing them with the appropriate size bytes object.

A serialization example:

```
from fips203 import ML_KEM_768

(ek,dk) = ML_KEM_768.keygen()
with open('encapskey.bin', 'wb') as f:
    f.write(bytes(ek))
with open('decapskey.bin', 'wb') as f:
    f.write(bytes(dk))
```

A deserialization example, followed by use:

```
import fips203

with open('encapskey.bin', 'b') as f:
    ekdata = f.read()

ek = fips203.EncapsulationKey(ekdata)
(ct, ss) = ek.Encaps()
```

The expected sizes (in bytes) of the different objects in each
parameter set can be accessed with `EK_SIZE`, `DK_SIZE`, `CT_SIZE`,
and `SS_SIZE`:

```
from fips203 import ML_KEM_768

print(f"ML-KEM-768 Ciphertext size (in bytes) is {ML_KEM_768.CT_SIZE}")
```

## Implementation Notes

This is a wrapper around libfips203, built from the Rust fips203-ffi crate.

If that library is not installed in the expected path for libraries on
your system, any attempt to use this module will fail.

This module should have reasonable type annotations and docstrings for
the public interface.  If you discover a problem with type
annotations, or see a way that this kind of documentation could be
improved, please report it!

## See Also

- https://doi.org/10.6028/NIST.FIPS.203.ipd
- https://github.com/integritychain/fips203

## Bug Reporting

Please report issues at https://github.com/integritychain/fips203/issues

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fips203",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "cryptography, encryption, FIPS, FIPS203, KEM, lattice, module-lattice, post-quantum",
    "author": null,
    "author_email": "Daniel Kahn Gillmor <dkg@fifthhorseman.net>",
    "download_url": "https://files.pythonhosted.org/packages/25/ec/280b773a986af03700796e7f69aaa4c98ccc0ab66b1d8de401671fe47232/fips203-0.2.1.tar.gz",
    "platform": null,
    "description": "# `fips203` Python module\n\nThis Python module provides an implementation of FIPS 203, the\nModule-Lattice-based Key Encapsulation Mechanism Standard.\n\nThe underlying mechanism is intended to offer \"post-quantum\"\nasymmetric encryption and decryption.\n\n## Example\n\nThe following example shows using the standard ML-KEM algorithm to\nproduce identical 32-byte shared secrets:\n\n```\nfrom fips203 import ML_KEM_512\n\n(encapsulation_key, decapsulation_key) = ML_KEM_512.keygen()\n(ciphertext, shared_secret_1) = encapsulation_key.encaps()\nshared_secret_2 = decapsulation_key.decaps(ciphertext)\nassert(shared_secret_1 == shared_secret_2)\n```\n\nEncapsulation keys, decapsulation keys, and ciphertexts can all be\nserialized by accessing them as `bytes`, and deserialized by\ninitializing them with the appropriate size bytes object.\n\nA serialization example:\n\n```\nfrom fips203 import ML_KEM_768\n\n(ek,dk) = ML_KEM_768.keygen()\nwith open('encapskey.bin', 'wb') as f:\n    f.write(bytes(ek))\nwith open('decapskey.bin', 'wb') as f:\n    f.write(bytes(dk))\n```\n\nA deserialization example, followed by use:\n\n```\nimport fips203\n\nwith open('encapskey.bin', 'b') as f:\n    ekdata = f.read()\n\nek = fips203.EncapsulationKey(ekdata)\n(ct, ss) = ek.Encaps()\n```\n\nThe expected sizes (in bytes) of the different objects in each\nparameter set can be accessed with `EK_SIZE`, `DK_SIZE`, `CT_SIZE`,\nand `SS_SIZE`:\n\n```\nfrom fips203 import ML_KEM_768\n\nprint(f\"ML-KEM-768 Ciphertext size (in bytes) is {ML_KEM_768.CT_SIZE}\")\n```\n\n## Implementation Notes\n\nThis is a wrapper around libfips203, built from the Rust fips203-ffi crate.\n\nIf that library is not installed in the expected path for libraries on\nyour system, any attempt to use this module will fail.\n\nThis module should have reasonable type annotations and docstrings for\nthe public interface.  If you discover a problem with type\nannotations, or see a way that this kind of documentation could be\nimproved, please report it!\n\n## See Also\n\n- https://doi.org/10.6028/NIST.FIPS.203.ipd\n- https://github.com/integritychain/fips203\n\n## Bug Reporting\n\nPlease report issues at https://github.com/integritychain/fips203/issues\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "ML-KEM (FIPS203) -- asymmetric, quantum-secure encryption (Initial Public Draft)",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/integritychain/fips203/tree/main/ffi/python",
        "Issues": "https://github.com/integritychain/fips203/issues",
        "Repository": "https://github.com/integritychain/fips203.git"
    },
    "split_keywords": [
        "cryptography",
        " encryption",
        " fips",
        " fips203",
        " kem",
        " lattice",
        " module-lattice",
        " post-quantum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "616645d61932933640cf49e9c3aee216c9f46a7be1cfd8b874eddbdafb0c33b6",
                "md5": "64a91e42077cd8a5f92bb74e8f737681",
                "sha256": "23078593b56958057d6c1d6baf4f8934dc78393c0c2aa2fb5ff4b0a7cad6ec99"
            },
            "downloads": -1,
            "filename": "fips203-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64a91e42077cd8a5f92bb74e8f737681",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5544,
            "upload_time": "2024-06-12T22:13:07",
            "upload_time_iso_8601": "2024-06-12T22:13:07.638540Z",
            "url": "https://files.pythonhosted.org/packages/61/66/45d61932933640cf49e9c3aee216c9f46a7be1cfd8b874eddbdafb0c33b6/fips203-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25ec280b773a986af03700796e7f69aaa4c98ccc0ab66b1d8de401671fe47232",
                "md5": "529f4b6b9b9045a7f9fb09d9af7ca01e",
                "sha256": "875a726111dbd5c78f3a1189ba1b015e66de09dc1fbdc5f87b6b71ce4033923d"
            },
            "downloads": -1,
            "filename": "fips203-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "529f4b6b9b9045a7f9fb09d9af7ca01e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4804,
            "upload_time": "2024-06-12T22:13:09",
            "upload_time_iso_8601": "2024-06-12T22:13:09.169085Z",
            "url": "https://files.pythonhosted.org/packages/25/ec/280b773a986af03700796e7f69aaa4c98ccc0ab66b1d8de401671fe47232/fips203-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-12 22:13:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "integritychain",
    "github_project": "fips203",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fips203"
}
        
Elapsed time: 0.51051s