swarmauri_cipher_suite_fips203 0.1.0.dev11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swarmauri_cipher_suite_fips203-0.1.0.dev11/PKG-INFO +109 -0
- swarmauri_cipher_suite_fips203-0.1.0.dev11/README.md +83 -0
- swarmauri_cipher_suite_fips203-0.1.0.dev11/pyproject.toml +80 -0
- swarmauri_cipher_suite_fips203-0.1.0.dev11/swarmauri_cipher_suite_fips203/Fips203CipherSuite.py +83 -0
- swarmauri_cipher_suite_fips203-0.1.0.dev11/swarmauri_cipher_suite_fips203/__init__.py +5 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_cipher_suite_fips203
|
|
3
|
+
Version: 0.1.0.dev11
|
|
4
|
+
Summary: FIPS 203 ML-KEM cipher suite bindings for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: swarmauri,sdk,standards,cipher,suite,fips,fips203,ml-kem,crystals-kyber,post-quantum,cryptography
|
|
7
|
+
Author: Jacob Stewart
|
|
8
|
+
Author-email: jacob@swarmauri.com
|
|
9
|
+
Requires-Python: >=3.10,<3.13
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Topic :: Security :: Cryptography
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Requires-Dist: swarmauri_base
|
|
23
|
+
Requires-Dist: swarmauri_core
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
30
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_cipher_suite_fips203" alt="PyPI - Downloads"/></a>
|
|
31
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips203/">
|
|
32
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips203.svg"/></a>
|
|
33
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
34
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_cipher_suite_fips203" alt="PyPI - Python Version"/></a>
|
|
35
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
36
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_cipher_suite_fips203" alt="PyPI - License"/></a>
|
|
37
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_cipher_suite_fips203?label=swarmauri_cipher_suite_fips203&color=green" alt="PyPI - swarmauri_cipher_suite_fips203"/></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Swarmauri Cipher Suite FIPS 203
|
|
44
|
+
|
|
45
|
+
Cipher suite bindings for the post-quantum ML-KEM key encapsulation mechanisms
|
|
46
|
+
standardised in NIST FIPS 203.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Enumerates the ML-KEM-512, ML-KEM-768, and ML-KEM-1024 parameter sets
|
|
51
|
+
- Describes NIST security level metadata for downstream policy enforcement
|
|
52
|
+
- Normalises wrap / unwrap requests with provider-oriented descriptors
|
|
53
|
+
- Ships entry-point metadata for seamless Swarmauri component discovery
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
### pip
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install swarmauri_cipher_suite_fips203
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Poetry
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
poetry add swarmauri_cipher_suite_fips203
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### uv
|
|
70
|
+
|
|
71
|
+
To add the dependency to a `pyproject.toml` managed by `uv`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv add swarmauri_cipher_suite_fips203
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or install it into the active environment:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv pip install swarmauri_cipher_suite_fips203
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from swarmauri_cipher_suite_fips203 import Fips203CipherSuite
|
|
87
|
+
|
|
88
|
+
suite = Fips203CipherSuite(name="mlkem")
|
|
89
|
+
|
|
90
|
+
# Describe a ML-KEM-768 key encapsulation request
|
|
91
|
+
descriptor = suite.normalize(op="wrap", alg="ML-KEM-768")
|
|
92
|
+
print(descriptor["constraints"]["nistLevel"]) # -> 3
|
|
93
|
+
print(descriptor["mapped"]["provider"]) # -> ml-kem:ML-KEM-768
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The suite raises `ValueError` if a non-ML-KEM algorithm is requested, allowing
|
|
97
|
+
callers to surface the policy violation immediately.
|
|
98
|
+
|
|
99
|
+
## Entry Point
|
|
100
|
+
|
|
101
|
+
The suite registers under the `swarmauri.cipher_suites` entry point as
|
|
102
|
+
`Fips203CipherSuite`.
|
|
103
|
+
|
|
104
|
+
## Want to help?
|
|
105
|
+
|
|
106
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
107
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
108
|
+
that will help you get started.
|
|
109
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
5
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_cipher_suite_fips203" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips203/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips203.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_cipher_suite_fips203" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_cipher_suite_fips203" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips203/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_cipher_suite_fips203?label=swarmauri_cipher_suite_fips203&color=green" alt="PyPI - swarmauri_cipher_suite_fips203"/></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Swarmauri Cipher Suite FIPS 203
|
|
19
|
+
|
|
20
|
+
Cipher suite bindings for the post-quantum ML-KEM key encapsulation mechanisms
|
|
21
|
+
standardised in NIST FIPS 203.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- Enumerates the ML-KEM-512, ML-KEM-768, and ML-KEM-1024 parameter sets
|
|
26
|
+
- Describes NIST security level metadata for downstream policy enforcement
|
|
27
|
+
- Normalises wrap / unwrap requests with provider-oriented descriptors
|
|
28
|
+
- Ships entry-point metadata for seamless Swarmauri component discovery
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
### pip
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install swarmauri_cipher_suite_fips203
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Poetry
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
poetry add swarmauri_cipher_suite_fips203
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### uv
|
|
45
|
+
|
|
46
|
+
To add the dependency to a `pyproject.toml` managed by `uv`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv add swarmauri_cipher_suite_fips203
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or install it into the active environment:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv pip install swarmauri_cipher_suite_fips203
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from swarmauri_cipher_suite_fips203 import Fips203CipherSuite
|
|
62
|
+
|
|
63
|
+
suite = Fips203CipherSuite(name="mlkem")
|
|
64
|
+
|
|
65
|
+
# Describe a ML-KEM-768 key encapsulation request
|
|
66
|
+
descriptor = suite.normalize(op="wrap", alg="ML-KEM-768")
|
|
67
|
+
print(descriptor["constraints"]["nistLevel"]) # -> 3
|
|
68
|
+
print(descriptor["mapped"]["provider"]) # -> ml-kem:ML-KEM-768
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The suite raises `ValueError` if a non-ML-KEM algorithm is requested, allowing
|
|
72
|
+
callers to surface the policy violation immediately.
|
|
73
|
+
|
|
74
|
+
## Entry Point
|
|
75
|
+
|
|
76
|
+
The suite registers under the `swarmauri.cipher_suites` entry point as
|
|
77
|
+
`Fips203CipherSuite`.
|
|
78
|
+
|
|
79
|
+
## Want to help?
|
|
80
|
+
|
|
81
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
82
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
83
|
+
that will help you get started.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "swarmauri_cipher_suite_fips203"
|
|
3
|
+
version = "0.1.0.dev11"
|
|
4
|
+
description = "FIPS 203 ML-KEM cipher suite bindings for Swarmauri"
|
|
5
|
+
license = "Apache-2.0"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.10,<3.13"
|
|
8
|
+
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"License :: OSI Approved :: Apache Software License",
|
|
11
|
+
"Natural Language :: English",
|
|
12
|
+
"Programming Language :: Python :: 3.10",
|
|
13
|
+
"Programming Language :: Python :: 3.11",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Topic :: Security :: Cryptography",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"swarmauri_core",
|
|
25
|
+
"swarmauri_base",
|
|
26
|
+
]
|
|
27
|
+
keywords = [
|
|
28
|
+
"swarmauri",
|
|
29
|
+
"sdk",
|
|
30
|
+
"standards",
|
|
31
|
+
"cipher",
|
|
32
|
+
"suite",
|
|
33
|
+
"fips",
|
|
34
|
+
"fips203",
|
|
35
|
+
"ml-kem",
|
|
36
|
+
"crystals-kyber",
|
|
37
|
+
"post-quantum",
|
|
38
|
+
"cryptography",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.uv.sources]
|
|
42
|
+
swarmauri_core = { workspace = true }
|
|
43
|
+
swarmauri_base = { workspace = true }
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
norecursedirs = ["combined", "scripts"]
|
|
47
|
+
markers = [
|
|
48
|
+
"test: standard test",
|
|
49
|
+
"unit: Unit tests",
|
|
50
|
+
"i9n: Integration tests",
|
|
51
|
+
"r8n: Regression tests",
|
|
52
|
+
"acceptance: Acceptance tests",
|
|
53
|
+
"perf: Performance tests",
|
|
54
|
+
"example: README-backed usage examples",
|
|
55
|
+
]
|
|
56
|
+
timeout = 300
|
|
57
|
+
log_cli = true
|
|
58
|
+
log_cli_level = "INFO"
|
|
59
|
+
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
60
|
+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
61
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
62
|
+
|
|
63
|
+
[dependency-groups]
|
|
64
|
+
dev = [
|
|
65
|
+
"pytest>=8.0",
|
|
66
|
+
"pytest-asyncio>=0.24.0",
|
|
67
|
+
"pytest-xdist>=3.6.1",
|
|
68
|
+
"pytest-json-report>=1.5.0",
|
|
69
|
+
"pytest-timeout>=2.3.1",
|
|
70
|
+
"pytest-benchmark>=4.0.0",
|
|
71
|
+
"flake8>=7.0",
|
|
72
|
+
"ruff>=0.9.9",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[build-system]
|
|
76
|
+
requires = ["poetry-core>=1.0.0"]
|
|
77
|
+
build-backend = "poetry.core.masonry.api"
|
|
78
|
+
|
|
79
|
+
[project.entry-points.'swarmauri.cipher_suites']
|
|
80
|
+
Fips203CipherSuite = "swarmauri_cipher_suite_fips203:Fips203CipherSuite"
|
swarmauri_cipher_suite_fips203-0.1.0.dev11/swarmauri_cipher_suite_fips203/Fips203CipherSuite.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Iterable, Mapping, Optional
|
|
4
|
+
|
|
5
|
+
from swarmauri_base.cipher_suites import CipherSuiteBase
|
|
6
|
+
from swarmauri_base.ComponentBase import ComponentBase
|
|
7
|
+
from swarmauri_core.cipher_suites import (
|
|
8
|
+
Alg,
|
|
9
|
+
CipherOp,
|
|
10
|
+
Features,
|
|
11
|
+
KeyRef,
|
|
12
|
+
NormalizedDescriptor,
|
|
13
|
+
ParamMapping,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
_ML_KEM: tuple[Alg, ...] = ("ML-KEM-512", "ML-KEM-768", "ML-KEM-1024")
|
|
17
|
+
_ML_KEM_LEVEL = {"ML-KEM-512": 1, "ML-KEM-768": 3, "ML-KEM-1024": 5}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@ComponentBase.register_type(CipherSuiteBase, "Fips203CipherSuite")
|
|
21
|
+
class Fips203CipherSuite(CipherSuiteBase):
|
|
22
|
+
"""FIPS 203 compliant ML-KEM cipher suite."""
|
|
23
|
+
|
|
24
|
+
def suite_id(self) -> str:
|
|
25
|
+
return "fips-203"
|
|
26
|
+
|
|
27
|
+
def supports(self) -> Mapping[CipherOp, Iterable[Alg]]:
|
|
28
|
+
return {"wrap": _ML_KEM, "unwrap": _ML_KEM}
|
|
29
|
+
|
|
30
|
+
def default_alg(self, op: CipherOp, *, for_key: Optional[KeyRef] = None) -> Alg:
|
|
31
|
+
return "ML-KEM-768"
|
|
32
|
+
|
|
33
|
+
def policy(self) -> Mapping[str, object]:
|
|
34
|
+
return {
|
|
35
|
+
"fips": "203",
|
|
36
|
+
"nist_document": "ML-KEM",
|
|
37
|
+
"nist_security_levels": _ML_KEM_LEVEL,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def features(self) -> Features:
|
|
41
|
+
return {
|
|
42
|
+
"suite": "fips-203",
|
|
43
|
+
"version": 1,
|
|
44
|
+
"dialects": {"provider": list(_ML_KEM)},
|
|
45
|
+
"ops": {
|
|
46
|
+
"wrap": {"default": "ML-KEM-768", "allowed": list(_ML_KEM)},
|
|
47
|
+
},
|
|
48
|
+
"constraints": {"nistSecurityLevels": _ML_KEM_LEVEL},
|
|
49
|
+
"compliance": {"fips203": True, "pqc": True},
|
|
50
|
+
"notes": [
|
|
51
|
+
"Implements the CRYSTALS-Kyber based ML-KEM selections from FIPS 203.",
|
|
52
|
+
],
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
def normalize(
|
|
56
|
+
self,
|
|
57
|
+
*,
|
|
58
|
+
op: CipherOp,
|
|
59
|
+
alg: Optional[Alg] = None,
|
|
60
|
+
key: Optional[KeyRef] = None,
|
|
61
|
+
params: Optional[ParamMapping] = None,
|
|
62
|
+
dialect: Optional[str] = None,
|
|
63
|
+
) -> NormalizedDescriptor:
|
|
64
|
+
allowed = set(self.supports().get(op, ()))
|
|
65
|
+
chosen = alg or self.default_alg(op)
|
|
66
|
+
if chosen not in allowed:
|
|
67
|
+
raise ValueError(f"{chosen=} not supported for {op=}")
|
|
68
|
+
|
|
69
|
+
resolved = dict(params or {})
|
|
70
|
+
chosen_dialect = "provider" if dialect is None else dialect
|
|
71
|
+
mapped = {"provider": f"ml-kem:{chosen}"}
|
|
72
|
+
|
|
73
|
+
constraints = {"nistLevel": _ML_KEM_LEVEL[chosen], "category": "post-quantum"}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
"op": op,
|
|
77
|
+
"alg": chosen,
|
|
78
|
+
"dialect": chosen_dialect,
|
|
79
|
+
"mapped": mapped,
|
|
80
|
+
"params": resolved,
|
|
81
|
+
"constraints": constraints,
|
|
82
|
+
"policy": self.policy(),
|
|
83
|
+
}
|