swarmauri_cipher_suite_fips204 0.1.0.dev24__py3-none-any.whl
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_fips204/Fips204CipherSuite.py +83 -0
- swarmauri_cipher_suite_fips204/__init__.py +5 -0
- swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/METADATA +110 -0
- swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/RECORD +6 -0
- swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/WHEEL +4 -0
- swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/entry_points.txt +3 -0
|
@@ -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_DSA: tuple[Alg, ...] = ("ML-DSA-44", "ML-DSA-65", "ML-DSA-87")
|
|
17
|
+
_ML_DSA_LEVEL = {"ML-DSA-44": 1, "ML-DSA-65": 3, "ML-DSA-87": 5}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@ComponentBase.register_type(CipherSuiteBase, "Fips204CipherSuite")
|
|
21
|
+
class Fips204CipherSuite(CipherSuiteBase):
|
|
22
|
+
"""FIPS 204 compliant ML-DSA signing suite."""
|
|
23
|
+
|
|
24
|
+
def suite_id(self) -> str:
|
|
25
|
+
return "fips-204"
|
|
26
|
+
|
|
27
|
+
def supports(self) -> Mapping[CipherOp, Iterable[Alg]]:
|
|
28
|
+
return {"sign": _ML_DSA, "verify": _ML_DSA}
|
|
29
|
+
|
|
30
|
+
def default_alg(self, op: CipherOp, *, for_key: Optional[KeyRef] = None) -> Alg:
|
|
31
|
+
return "ML-DSA-65"
|
|
32
|
+
|
|
33
|
+
def policy(self) -> Mapping[str, object]:
|
|
34
|
+
return {
|
|
35
|
+
"fips": "204",
|
|
36
|
+
"nist_document": "ML-DSA",
|
|
37
|
+
"nist_security_levels": _ML_DSA_LEVEL,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def features(self) -> Features:
|
|
41
|
+
return {
|
|
42
|
+
"suite": "fips-204",
|
|
43
|
+
"version": 1,
|
|
44
|
+
"dialects": {"provider": list(_ML_DSA)},
|
|
45
|
+
"ops": {
|
|
46
|
+
"sign": {"default": "ML-DSA-65", "allowed": list(_ML_DSA)},
|
|
47
|
+
},
|
|
48
|
+
"constraints": {"nistSecurityLevels": _ML_DSA_LEVEL},
|
|
49
|
+
"compliance": {"fips204": True, "pqc": True},
|
|
50
|
+
"notes": [
|
|
51
|
+
"Implements the ML-DSA (Dilithium) parameter sets from FIPS 204.",
|
|
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-dsa:{chosen}"}
|
|
72
|
+
|
|
73
|
+
constraints = {"nistLevel": _ML_DSA_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
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_cipher_suite_fips204
|
|
3
|
+
Version: 0.1.0.dev24
|
|
4
|
+
Summary: FIPS 204 ML-DSA cipher suite bindings for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: swarmauri,sdk,standards,cipher,suite,fips,fips204,ml-dsa,dilithium,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_fips204/">
|
|
30
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_cipher_suite_fips204" alt="PyPI - Downloads"/></a>
|
|
31
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips204/">
|
|
32
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_cipher_suite_fips204.svg"/></a>
|
|
33
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips204/">
|
|
34
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_cipher_suite_fips204" alt="PyPI - Python Version"/></a>
|
|
35
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips204/">
|
|
36
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_cipher_suite_fips204" alt="PyPI - License"/></a>
|
|
37
|
+
<a href="https://pypi.org/project/swarmauri_cipher_suite_fips204/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_cipher_suite_fips204?label=swarmauri_cipher_suite_fips204&color=green" alt="PyPI - swarmauri_cipher_suite_fips204"/></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Swarmauri Cipher Suite FIPS 204
|
|
44
|
+
|
|
45
|
+
ML-DSA (Dilithium) signature suite aligned with the requirements of NIST
|
|
46
|
+
FIPS 204.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Supports ML-DSA-44, ML-DSA-65, and ML-DSA-87 parameter sets
|
|
51
|
+
- Provides NIST security level metadata for policy-aware services
|
|
52
|
+
- Normalises post-quantum signing requests using provider dialect mappings
|
|
53
|
+
- Integrates with Swarmauri discovery via the `swarmauri.cipher_suites` entry
|
|
54
|
+
point
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
### pip
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install swarmauri_cipher_suite_fips204
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Poetry
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
poetry add swarmauri_cipher_suite_fips204
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### uv
|
|
71
|
+
|
|
72
|
+
To add the dependency to a `pyproject.toml` managed by `uv`:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv add swarmauri_cipher_suite_fips204
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or install it into the active environment:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv pip install swarmauri_cipher_suite_fips204
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from swarmauri_cipher_suite_fips204 import Fips204CipherSuite
|
|
88
|
+
|
|
89
|
+
suite = Fips204CipherSuite(name="mldsa")
|
|
90
|
+
|
|
91
|
+
# Prepare a ML-DSA-65 signing descriptor
|
|
92
|
+
descriptor = suite.normalize(op="sign", alg="ML-DSA-65")
|
|
93
|
+
print(descriptor["constraints"]["nistLevel"]) # -> 3
|
|
94
|
+
print(descriptor["mapped"]["provider"]) # -> ml-dsa:ML-DSA-65
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Unsupported algorithms raise `ValueError`, signalling the policy violation to
|
|
98
|
+
callers.
|
|
99
|
+
|
|
100
|
+
## Entry Point
|
|
101
|
+
|
|
102
|
+
The suite registers under the `swarmauri.cipher_suites` entry point as
|
|
103
|
+
`Fips204CipherSuite`.
|
|
104
|
+
|
|
105
|
+
## Want to help?
|
|
106
|
+
|
|
107
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
108
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
109
|
+
that will help you get started.
|
|
110
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
swarmauri_cipher_suite_fips204/Fips204CipherSuite.py,sha256=NZTR4i4QVgoU0tfTwnxAF8G8JID-ISqoUZYj5zagd4Q,2593
|
|
2
|
+
swarmauri_cipher_suite_fips204/__init__.py,sha256=cylD9lUtZhCi9Tp5YxFh5Vg_ADKhU8J--sNcuGrZqV8,139
|
|
3
|
+
swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/METADATA,sha256=gjqh6ICM-8vd0_oqLBz7-a-Ogvx-RZoN4edxhYxpiPk,3824
|
|
4
|
+
swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
5
|
+
swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/entry_points.txt,sha256=GJAl1EkWumhBZTMg4t0OLM_hdd4xL0gKX7y1B-w-tlY,96
|
|
6
|
+
swarmauri_cipher_suite_fips204-0.1.0.dev24.dist-info/RECORD,,
|