swarmauri_signing_rsa 0.3.0.dev3__tar.gz → 0.3.0.dev30__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.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_signing_rsa
3
+ Version: 0.3.0.dev30
4
+ Summary: RSA-based signer for Swarmauri
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,signing,rsa,public-key,cryptography,sdk,standards,digital-signature,pkcs1,signature-algorithm,key-formats
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: Development Status :: 1 - Planning
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Security :: Cryptography
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Provides-Extra: cbor
23
+ Requires-Dist: cbor2 ; extra == "cbor"
24
+ Requires-Dist: cryptography
25
+ Requires-Dist: swarmauri_base
26
+ Requires-Dist: swarmauri_core
27
+ Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_rsa#readme
28
+ Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
29
+ Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_rsa
30
+ Description-Content-Type: text/markdown
31
+
32
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
33
+
34
+
35
+ <p align="center">
36
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
37
+ <img src="https://img.shields.io/pypi/dm/swarmauri_signing_rsa" alt="PyPI - Downloads"/></a>
38
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_rsa/">
39
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_rsa.svg"/></a>
40
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
41
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_signing_rsa" alt="PyPI - Python Version"/></a>
42
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
43
+ <img src="https://img.shields.io/pypi/l/swarmauri_signing_rsa" alt="PyPI - License"/></a>
44
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
45
+ <img src="https://img.shields.io/pypi/v/swarmauri_signing_rsa?label=swarmauri_signing_rsa&color=green" alt="PyPI - swarmauri_signing_rsa"/></a>
46
+ </p>
47
+
48
+ ---
49
+
50
+ # Swarmauri Signing RSA
51
+
52
+ An asynchronous RSA signer implementing the `ISigning` interface for detached
53
+ signatures over raw bytes and canonicalized envelopes.
54
+
55
+ ## Capabilities
56
+
57
+ - Detached signatures for byte payloads as well as canonicalized envelopes
58
+ - JSON canonicalization is built in; CBOR canonicalization is available when
59
+ [`cbor2`](https://pypi.org/project/cbor2/) is installed
60
+ - RSA-PSS-SHA256 (default) and RS256 signature algorithms powered by
61
+ [`cryptography`](https://pypi.org/project/cryptography/)
62
+ - Verification requires the expected RSA public keys to be provided through
63
+ `opts["pubkeys"]`, enabling multi-signer verification scenarios
64
+ - Private and public keys can be supplied as PEM strings, filesystem paths,
65
+ RFC 7517 JWKs, or raw `cryptography` key objects via Swarmauri `KeyRef`
66
+ dictionaries
67
+
68
+ ## Installation
69
+
70
+ Pick the tool that matches your workflow:
71
+
72
+ ```bash
73
+ # pip
74
+ pip install swarmauri_signing_rsa
75
+
76
+ # Poetry
77
+ poetry add swarmauri_signing_rsa
78
+
79
+ # uv
80
+ uv add swarmauri_signing_rsa
81
+ ```
82
+
83
+ ## Quickstart
84
+
85
+ The example below generates an RSA key, signs a JSON envelope, and then verifies
86
+ the detached signature using the corresponding public key. The same pattern
87
+ applies to raw byte payloads via `sign_bytes`/`verify_bytes`.
88
+
89
+ ```python
90
+ import asyncio
91
+
92
+ from cryptography.hazmat.primitives.asymmetric import rsa
93
+
94
+ from swarmauri_signing_rsa import RSAEnvelopeSigner
95
+
96
+
97
+ def key_ref_from_private(private_key):
98
+ return {"kind": "cryptography_obj", "obj": private_key}
99
+
100
+
101
+ def key_ref_from_public(public_key):
102
+ return {"kind": "cryptography_obj", "obj": public_key}
103
+
104
+
105
+ async def main() -> None:
106
+ signer = RSAEnvelopeSigner()
107
+ private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
108
+
109
+ envelope = {"payload": {"msg": "hello"}, "headers": {"alg": "RSA-PSS-SHA256"}}
110
+
111
+ signatures = await signer.sign_envelope(
112
+ key_ref_from_private(private_key),
113
+ envelope,
114
+ canon="json",
115
+ alg="RSA-PSS-SHA256",
116
+ )
117
+
118
+ is_valid = await signer.verify_envelope(
119
+ envelope,
120
+ signatures,
121
+ opts={"pubkeys": [key_ref_from_public(private_key.public_key())]},
122
+ )
123
+
124
+ assert is_valid
125
+
126
+
127
+ asyncio.run(main())
128
+ ```
129
+
130
+ ## Entry Point
131
+
132
+ The signer registers under the `swarmauri.signings` entry point as
133
+ `RSAEnvelopeSigner` and exposes the same name for the Peagen plugin registry.
134
+
135
+ ## Want to help?
136
+
137
+ If you want to contribute to swarmauri-sdk, read up on our
138
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
139
+ that will help you get started.
@@ -0,0 +1,108 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+
4
+ <p align="center">
5
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
6
+ <img src="https://img.shields.io/pypi/dm/swarmauri_signing_rsa" alt="PyPI - Downloads"/></a>
7
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_rsa/">
8
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_rsa.svg"/></a>
9
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
10
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_signing_rsa" alt="PyPI - Python Version"/></a>
11
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
12
+ <img src="https://img.shields.io/pypi/l/swarmauri_signing_rsa" alt="PyPI - License"/></a>
13
+ <a href="https://pypi.org/project/swarmauri_signing_rsa/">
14
+ <img src="https://img.shields.io/pypi/v/swarmauri_signing_rsa?label=swarmauri_signing_rsa&color=green" alt="PyPI - swarmauri_signing_rsa"/></a>
15
+ </p>
16
+
17
+ ---
18
+
19
+ # Swarmauri Signing RSA
20
+
21
+ An asynchronous RSA signer implementing the `ISigning` interface for detached
22
+ signatures over raw bytes and canonicalized envelopes.
23
+
24
+ ## Capabilities
25
+
26
+ - Detached signatures for byte payloads as well as canonicalized envelopes
27
+ - JSON canonicalization is built in; CBOR canonicalization is available when
28
+ [`cbor2`](https://pypi.org/project/cbor2/) is installed
29
+ - RSA-PSS-SHA256 (default) and RS256 signature algorithms powered by
30
+ [`cryptography`](https://pypi.org/project/cryptography/)
31
+ - Verification requires the expected RSA public keys to be provided through
32
+ `opts["pubkeys"]`, enabling multi-signer verification scenarios
33
+ - Private and public keys can be supplied as PEM strings, filesystem paths,
34
+ RFC 7517 JWKs, or raw `cryptography` key objects via Swarmauri `KeyRef`
35
+ dictionaries
36
+
37
+ ## Installation
38
+
39
+ Pick the tool that matches your workflow:
40
+
41
+ ```bash
42
+ # pip
43
+ pip install swarmauri_signing_rsa
44
+
45
+ # Poetry
46
+ poetry add swarmauri_signing_rsa
47
+
48
+ # uv
49
+ uv add swarmauri_signing_rsa
50
+ ```
51
+
52
+ ## Quickstart
53
+
54
+ The example below generates an RSA key, signs a JSON envelope, and then verifies
55
+ the detached signature using the corresponding public key. The same pattern
56
+ applies to raw byte payloads via `sign_bytes`/`verify_bytes`.
57
+
58
+ ```python
59
+ import asyncio
60
+
61
+ from cryptography.hazmat.primitives.asymmetric import rsa
62
+
63
+ from swarmauri_signing_rsa import RSAEnvelopeSigner
64
+
65
+
66
+ def key_ref_from_private(private_key):
67
+ return {"kind": "cryptography_obj", "obj": private_key}
68
+
69
+
70
+ def key_ref_from_public(public_key):
71
+ return {"kind": "cryptography_obj", "obj": public_key}
72
+
73
+
74
+ async def main() -> None:
75
+ signer = RSAEnvelopeSigner()
76
+ private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
77
+
78
+ envelope = {"payload": {"msg": "hello"}, "headers": {"alg": "RSA-PSS-SHA256"}}
79
+
80
+ signatures = await signer.sign_envelope(
81
+ key_ref_from_private(private_key),
82
+ envelope,
83
+ canon="json",
84
+ alg="RSA-PSS-SHA256",
85
+ )
86
+
87
+ is_valid = await signer.verify_envelope(
88
+ envelope,
89
+ signatures,
90
+ opts={"pubkeys": [key_ref_from_public(private_key.public_key())]},
91
+ )
92
+
93
+ assert is_valid
94
+
95
+
96
+ asyncio.run(main())
97
+ ```
98
+
99
+ ## Entry Point
100
+
101
+ The signer registers under the `swarmauri.signings` entry point as
102
+ `RSAEnvelopeSigner` and exposes the same name for the Peagen plugin registry.
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.
@@ -1,21 +1,36 @@
1
1
  [project]
2
2
  name = "swarmauri_signing_rsa"
3
- version = "0.3.0.dev3"
3
+ version = "0.3.0.dev30"
4
4
  description = "RSA-based signer for Swarmauri"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.10,<3.13"
8
- authors = [{ name = "Swarmauri", email = "opensource@swarmauri.com" }]
8
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
9
+ keywords = [
10
+ "swarmauri",
11
+ "signing",
12
+ "rsa",
13
+ "public-key",
14
+ "cryptography",
15
+ "sdk",
16
+ "standards",
17
+ "digital-signature",
18
+ "pkcs1",
19
+ "signature-algorithm",
20
+ "key-formats",
21
+ ]
9
22
  classifiers = [
23
+ "Development Status :: 1 - Planning",
10
24
  "License :: OSI Approved :: Apache Software License",
11
25
  "Natural Language :: English",
26
+ "Programming Language :: Python",
27
+ "Programming Language :: Python :: 3",
12
28
  "Programming Language :: Python :: 3.10",
13
29
  "Programming Language :: Python :: 3.11",
14
30
  "Programming Language :: Python :: 3.12",
15
- "Programming Language :: Python :: 3.13",
16
- "Development Status :: 3 - Alpha",
17
31
  "Topic :: Security :: Cryptography",
18
32
  "Intended Audience :: Developers",
33
+ "Programming Language :: Python :: 3 :: Only",
19
34
  ]
20
35
  dependencies = [
21
36
  "swarmauri_core",
@@ -23,6 +38,11 @@ dependencies = [
23
38
  "cryptography",
24
39
  ]
25
40
 
41
+ [project.urls]
42
+ Homepage = "https://github.com/swarmauri/swarmauri-sdk"
43
+ Source = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_rsa"
44
+ Documentation = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_rsa#readme"
45
+
26
46
  [project.optional-dependencies]
27
47
  cbor = ["cbor2"]
28
48
 
@@ -39,6 +59,7 @@ markers = [
39
59
  "r8n: Regression tests",
40
60
  "acceptance: Acceptance tests",
41
61
  "perf: Performance tests",
62
+ "example: README examples",
42
63
  ]
43
64
  timeout = 300
44
65
  log_cli = true
@@ -244,7 +244,14 @@ class RSAEnvelopeSigner(SigningBase):
244
244
  def supports(self) -> Mapping[str, Iterable[str]]:
245
245
  algs = ("RSA-PSS-SHA256", "RS256")
246
246
  canons = ("json", "cbor") if _CBOR_OK else ("json",)
247
- return {"algs": algs, "canons": canons, "features": ("multi", "detached_only")}
247
+ return {
248
+ "algs": algs,
249
+ "canons": canons,
250
+ "signs": ("bytes", "digest", "envelope", "stream"),
251
+ "verifies": ("bytes", "digest", "envelope", "stream"),
252
+ "envelopes": ("mapping",),
253
+ "features": ("multi", "detached_only"),
254
+ }
248
255
 
249
256
  async def sign_bytes(
250
257
  self,
@@ -339,6 +346,26 @@ class RSAEnvelopeSigner(SigningBase):
339
346
 
340
347
  return False
341
348
 
349
+ async def sign_digest(
350
+ self,
351
+ key: KeyRef,
352
+ digest: bytes,
353
+ *,
354
+ alg: Optional[Alg] = None,
355
+ opts: Optional[Mapping[str, object]] = None,
356
+ ) -> Sequence[Signature]:
357
+ return await self.sign_bytes(key, digest, alg=alg, opts=opts)
358
+
359
+ async def verify_digest(
360
+ self,
361
+ digest: bytes,
362
+ signatures: Sequence[Signature],
363
+ *,
364
+ require: Optional[Mapping[str, object]] = None,
365
+ opts: Optional[Mapping[str, object]] = None,
366
+ ) -> bool:
367
+ return await self.verify_bytes(digest, signatures, require=require, opts=opts)
368
+
342
369
  async def canonicalize_envelope(
343
370
  self,
344
371
  env: Envelope,
@@ -1,56 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_signing_rsa
3
- Version: 0.3.0.dev3
4
- Summary: RSA-based signer for Swarmauri
5
- License: Apache-2.0
6
- Author: Swarmauri
7
- Author-email: opensource@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Natural Language :: English
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Development Status :: 3 - Alpha
16
- Classifier: Topic :: Security :: Cryptography
17
- Classifier: Intended Audience :: Developers
18
- Provides-Extra: cbor
19
- Requires-Dist: cbor2 ; extra == "cbor"
20
- Requires-Dist: cryptography
21
- Requires-Dist: swarmauri_base
22
- Requires-Dist: swarmauri_core
23
- Description-Content-Type: text/markdown
24
-
25
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
26
-
27
- # Swarmauri Signing RSA
28
-
29
- An RSA-based signer implementing the `ISigning` interface for detached
30
- signatures over raw bytes and canonicalized envelopes.
31
-
32
- Features:
33
- - JSON canonicalization (always available)
34
- - Optional CBOR canonicalization via `cbor2`
35
- - Detached signatures using `cryptography`'s RSA primitives
36
- - Supports `RSA-PSS-SHA256` (recommended) and `RS256`
37
-
38
- ## Installation
39
-
40
- ```bash
41
- pip install swarmauri_signing_rsa
42
- ```
43
-
44
- ## Usage
45
-
46
- ```python
47
- from swarmauri_signing_rsa import RSAEnvelopeSigner
48
-
49
- signer = RSAEnvelopeSigner()
50
- # create a KeyRef for an RSA private key; see swarmauri_core for details
51
- ```
52
-
53
- ## Entry Point
54
-
55
- The signer registers under the `swarmauri.signings` entry point as `RSAEnvelopeSigner`.
56
-
@@ -1,31 +0,0 @@
1
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
2
-
3
- # Swarmauri Signing RSA
4
-
5
- An RSA-based signer implementing the `ISigning` interface for detached
6
- signatures over raw bytes and canonicalized envelopes.
7
-
8
- Features:
9
- - JSON canonicalization (always available)
10
- - Optional CBOR canonicalization via `cbor2`
11
- - Detached signatures using `cryptography`'s RSA primitives
12
- - Supports `RSA-PSS-SHA256` (recommended) and `RS256`
13
-
14
- ## Installation
15
-
16
- ```bash
17
- pip install swarmauri_signing_rsa
18
- ```
19
-
20
- ## Usage
21
-
22
- ```python
23
- from swarmauri_signing_rsa import RSAEnvelopeSigner
24
-
25
- signer = RSAEnvelopeSigner()
26
- # create a KeyRef for an RSA private key; see swarmauri_core for details
27
- ```
28
-
29
- ## Entry Point
30
-
31
- The signer registers under the `swarmauri.signings` entry point as `RSAEnvelopeSigner`.