swarmauri_mre_crypto_pgp 0.3.0.dev4__tar.gz → 0.3.0.dev32__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_mre_crypto_pgp-0.3.0.dev32/PKG-INFO +182 -0
- swarmauri_mre_crypto_pgp-0.3.0.dev32/README.md +149 -0
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/pyproject.toml +14 -2
- swarmauri_mre_crypto_pgp-0.3.0.dev4/PKG-INFO +0 -114
- swarmauri_mre_crypto_pgp-0.3.0.dev4/README.md +0 -85
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/LICENSE +0 -0
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/swarmauri_mre_crypto_pgp/PGPSealMreCrypto.py +0 -0
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/swarmauri_mre_crypto_pgp/__init__.py +0 -0
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/swarmauri_mre_crypto_pgp/pgp_mre.py +0 -0
- {swarmauri_mre_crypto_pgp-0.3.0.dev4 → swarmauri_mre_crypto_pgp-0.3.0.dev32}/swarmauri_mre_crypto_pgp/pgp_sealed_cek_mre.py +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_mre_crypto_pgp
|
|
3
|
+
Version: 0.3.0.dev32
|
|
4
|
+
Summary: OpenPGP sealed-per-recipient MRE provider for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,sdk,standards,mre,crypto,pgp,cryptography
|
|
8
|
+
Author: Jacob Stewart
|
|
9
|
+
Author-email: jacob@swarmauri.com
|
|
10
|
+
Requires-Python: >=3.10,<3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Development Status :: 3 - Alpha
|
|
18
|
+
Classifier: Topic :: Security :: Cryptography
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Programming Language :: Python
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Provides-Extra: cbor
|
|
24
|
+
Provides-Extra: cryptography
|
|
25
|
+
Provides-Extra: pgpy
|
|
26
|
+
Requires-Dist: cbor2 (>=5.4.6) ; extra == "cbor"
|
|
27
|
+
Requires-Dist: cryptography (>=41.0.0) ; extra == "cryptography"
|
|
28
|
+
Requires-Dist: pgpy (>=0.6.0)
|
|
29
|
+
Requires-Dist: pgpy (>=0.6.0) ; extra == "pgpy"
|
|
30
|
+
Requires-Dist: swarmauri_base
|
|
31
|
+
Requires-Dist: swarmauri_core
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
39
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp/">
|
|
40
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp.svg"/></a>
|
|
41
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
42
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
43
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
44
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_pgp" alt="PyPI - License"/></a>
|
|
45
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
46
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_pgp?label=swarmauri_mre_crypto_pgp&color=green" alt="PyPI - swarmauri_mre_crypto_pgp"/></a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Swarmauri MRE Crypto PGP
|
|
52
|
+
|
|
53
|
+
OpenPGP-based multi-recipient encryption providers that implement the
|
|
54
|
+
`IMreCrypto` contract. The package includes three concrete providers, all of
|
|
55
|
+
which rely on [PGPy](https://pgpy.readthedocs.io/) for public-key encryption.
|
|
56
|
+
Providers that wrap a shared content-encryption key (CEK) additionally require
|
|
57
|
+
[`cryptography`](https://cryptography.io/en/latest/).
|
|
58
|
+
|
|
59
|
+
### Highlights
|
|
60
|
+
|
|
61
|
+
- **PGPSealMreCrypto** – Implements the `sealed_per_recipient` mode. Each
|
|
62
|
+
recipient receives a sealed copy of the plaintext. Associated data (AAD) is
|
|
63
|
+
not supported and re-wrapping new recipients requires the original plaintext
|
|
64
|
+
via `opts["plaintext"]`.
|
|
65
|
+
- **PGPSealedCekMreCrypto** – Implements the `sealed_cek+aead` mode with an
|
|
66
|
+
AES-256-GCM payload. The CEK is sealed per recipient and can be re-used to
|
|
67
|
+
add or rotate recipients without decrypting the payload when
|
|
68
|
+
`opts["cek"]` or `opts["opener_identities"]` are supplied.
|
|
69
|
+
- **PGPMreCrypto** – Composite provider supporting both
|
|
70
|
+
`enc_once+per_recipient_header` (AES-256-GCM payload with OpenPGP headers)
|
|
71
|
+
and `sealed_per_recipient`. Re-wrapping shared-payload envelopes requires the
|
|
72
|
+
CEK via `opts["cek"]` or a managing private key supplied through
|
|
73
|
+
`opts["manage_key"]`.
|
|
74
|
+
|
|
75
|
+
All providers fingerprint OpenPGP keys to derive recipient identifiers. Public
|
|
76
|
+
keys can be supplied as live `PGPKey` objects or ASCII-armored blobs using the
|
|
77
|
+
following recipient `KeyRef` forms:
|
|
78
|
+
|
|
79
|
+
- `{"kind": "pgpy_pub", "pub": pgpy.PGPKey}`
|
|
80
|
+
- `{"kind": "pgpy_pub_armored", "pub": "-----BEGIN PGP PUBLIC KEY-----"}`
|
|
81
|
+
- `{"kind": "pgpy_key", "key": pgpy.PGPKey}` (sealed CEK helper that lifts
|
|
82
|
+
the public subkey from a combined key object)
|
|
83
|
+
|
|
84
|
+
Use these identity `KeyRef` forms when opening envelopes:
|
|
85
|
+
|
|
86
|
+
- `{"kind": "pgpy_priv", "priv": pgpy.PGPKey}`
|
|
87
|
+
- `{"kind": "pgpy_priv_armored", "priv": "-----BEGIN PGP PRIVATE KEY-----"}`
|
|
88
|
+
- `{"kind": "pgpy_key", "key": pgpy.PGPKey}` (sealed CEK provider)
|
|
89
|
+
- `{"kind": "pgpy_key_armored", "key": "-----BEGIN PGP PRIVATE KEY-----"}`
|
|
90
|
+
|
|
91
|
+
Private keys may be locked; pass the unlocking secret in `opts["passphrase"]`.
|
|
92
|
+
|
|
93
|
+
### Installation
|
|
94
|
+
|
|
95
|
+
Install the provider with your preferred packaging tool:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# pip
|
|
99
|
+
pip install swarmauri_mre_crypto_pgp
|
|
100
|
+
|
|
101
|
+
# Poetry
|
|
102
|
+
poetry add swarmauri_mre_crypto_pgp
|
|
103
|
+
|
|
104
|
+
# uv (project dependency)
|
|
105
|
+
uv add swarmauri_mre_crypto_pgp
|
|
106
|
+
|
|
107
|
+
# uv (virtualenv-only install)
|
|
108
|
+
uv pip install swarmauri_mre_crypto_pgp
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Usage
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import asyncio
|
|
115
|
+
from pgpy import PGPKey, PGPUID
|
|
116
|
+
from pgpy.constants import (
|
|
117
|
+
CompressionAlgorithm,
|
|
118
|
+
HashAlgorithm,
|
|
119
|
+
KeyFlags,
|
|
120
|
+
PubKeyAlgorithm,
|
|
121
|
+
SymmetricKeyAlgorithm,
|
|
122
|
+
)
|
|
123
|
+
from swarmauri_mre_crypto_pgp import PGPMreCrypto
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
async def main():
|
|
127
|
+
# Generate an OpenPGP key pair with pgpy
|
|
128
|
+
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
|
|
129
|
+
uid = PGPUID.new("Test User", email="test@example.com")
|
|
130
|
+
key.add_uid(
|
|
131
|
+
uid,
|
|
132
|
+
usage={KeyFlags.EncryptCommunications},
|
|
133
|
+
hashes=[HashAlgorithm.SHA256],
|
|
134
|
+
ciphers=[SymmetricKeyAlgorithm.AES256],
|
|
135
|
+
compression=[CompressionAlgorithm.ZLIB],
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Create references understood by the provider
|
|
139
|
+
pub_ref = {"kind": "pgpy_pub", "pub": key.pubkey}
|
|
140
|
+
priv_ref = {"kind": "pgpy_priv", "priv": key}
|
|
141
|
+
|
|
142
|
+
# Encrypt for many and open with the private key
|
|
143
|
+
mre = PGPMreCrypto()
|
|
144
|
+
pt = b"hello"
|
|
145
|
+
env = await mre.encrypt_for_many([pub_ref], pt)
|
|
146
|
+
rt = await mre.open_for(priv_ref, env)
|
|
147
|
+
print(rt)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
if __name__ == "__main__":
|
|
151
|
+
asyncio.run(main())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Selecting modes
|
|
155
|
+
|
|
156
|
+
`PGPMreCrypto` defaults to `MreMode.ENC_ONCE_HEADERS`. Pass
|
|
157
|
+
`mode=MreMode.SEALED_PER_RECIPIENT` (or the string value) to switch to the
|
|
158
|
+
sealed-per-recipient variant. `PGPSealedCekMreCrypto` always operates in the
|
|
159
|
+
`sealed_cek+aead` mode and will raise when the envelope mode or algorithms do
|
|
160
|
+
not match the expected values.
|
|
161
|
+
|
|
162
|
+
### Re-wrapping envelopes
|
|
163
|
+
|
|
164
|
+
- **Sealed per recipient** – Re-wrapping with additional recipients requires
|
|
165
|
+
`opts["plaintext"]` so the providers can seal the original payload again.
|
|
166
|
+
- **Shared CEK (enc_once / sealed_cek)** – Supply either the decrypted CEK via
|
|
167
|
+
`opts["cek"]` or provide identities capable of opening the envelope through
|
|
168
|
+
`opts["manage_key"]` (composite provider) or
|
|
169
|
+
`opts["opener_identities"]` (sealed CEK provider).
|
|
170
|
+
Enable payload rotation with `opts["rotate_payload_on_revoke"]` to generate a
|
|
171
|
+
fresh CEK when removing recipients.
|
|
172
|
+
|
|
173
|
+
## Entry point
|
|
174
|
+
|
|
175
|
+
Providers are registered under the `swarmauri.mre_cryptos` entry point as
|
|
176
|
+
`PGPSealMreCrypto`, `PGPSealedCekMreCrypto`, and `PGPMreCrypto`.
|
|
177
|
+
|
|
178
|
+
## Want to help?
|
|
179
|
+
|
|
180
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
181
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
182
|
+
that will help you get started.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
5
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_pgp" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_pgp?label=swarmauri_mre_crypto_pgp&color=green" alt="PyPI - swarmauri_mre_crypto_pgp"/></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Swarmauri MRE Crypto PGP
|
|
19
|
+
|
|
20
|
+
OpenPGP-based multi-recipient encryption providers that implement the
|
|
21
|
+
`IMreCrypto` contract. The package includes three concrete providers, all of
|
|
22
|
+
which rely on [PGPy](https://pgpy.readthedocs.io/) for public-key encryption.
|
|
23
|
+
Providers that wrap a shared content-encryption key (CEK) additionally require
|
|
24
|
+
[`cryptography`](https://cryptography.io/en/latest/).
|
|
25
|
+
|
|
26
|
+
### Highlights
|
|
27
|
+
|
|
28
|
+
- **PGPSealMreCrypto** – Implements the `sealed_per_recipient` mode. Each
|
|
29
|
+
recipient receives a sealed copy of the plaintext. Associated data (AAD) is
|
|
30
|
+
not supported and re-wrapping new recipients requires the original plaintext
|
|
31
|
+
via `opts["plaintext"]`.
|
|
32
|
+
- **PGPSealedCekMreCrypto** – Implements the `sealed_cek+aead` mode with an
|
|
33
|
+
AES-256-GCM payload. The CEK is sealed per recipient and can be re-used to
|
|
34
|
+
add or rotate recipients without decrypting the payload when
|
|
35
|
+
`opts["cek"]` or `opts["opener_identities"]` are supplied.
|
|
36
|
+
- **PGPMreCrypto** – Composite provider supporting both
|
|
37
|
+
`enc_once+per_recipient_header` (AES-256-GCM payload with OpenPGP headers)
|
|
38
|
+
and `sealed_per_recipient`. Re-wrapping shared-payload envelopes requires the
|
|
39
|
+
CEK via `opts["cek"]` or a managing private key supplied through
|
|
40
|
+
`opts["manage_key"]`.
|
|
41
|
+
|
|
42
|
+
All providers fingerprint OpenPGP keys to derive recipient identifiers. Public
|
|
43
|
+
keys can be supplied as live `PGPKey` objects or ASCII-armored blobs using the
|
|
44
|
+
following recipient `KeyRef` forms:
|
|
45
|
+
|
|
46
|
+
- `{"kind": "pgpy_pub", "pub": pgpy.PGPKey}`
|
|
47
|
+
- `{"kind": "pgpy_pub_armored", "pub": "-----BEGIN PGP PUBLIC KEY-----"}`
|
|
48
|
+
- `{"kind": "pgpy_key", "key": pgpy.PGPKey}` (sealed CEK helper that lifts
|
|
49
|
+
the public subkey from a combined key object)
|
|
50
|
+
|
|
51
|
+
Use these identity `KeyRef` forms when opening envelopes:
|
|
52
|
+
|
|
53
|
+
- `{"kind": "pgpy_priv", "priv": pgpy.PGPKey}`
|
|
54
|
+
- `{"kind": "pgpy_priv_armored", "priv": "-----BEGIN PGP PRIVATE KEY-----"}`
|
|
55
|
+
- `{"kind": "pgpy_key", "key": pgpy.PGPKey}` (sealed CEK provider)
|
|
56
|
+
- `{"kind": "pgpy_key_armored", "key": "-----BEGIN PGP PRIVATE KEY-----"}`
|
|
57
|
+
|
|
58
|
+
Private keys may be locked; pass the unlocking secret in `opts["passphrase"]`.
|
|
59
|
+
|
|
60
|
+
### Installation
|
|
61
|
+
|
|
62
|
+
Install the provider with your preferred packaging tool:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# pip
|
|
66
|
+
pip install swarmauri_mre_crypto_pgp
|
|
67
|
+
|
|
68
|
+
# Poetry
|
|
69
|
+
poetry add swarmauri_mre_crypto_pgp
|
|
70
|
+
|
|
71
|
+
# uv (project dependency)
|
|
72
|
+
uv add swarmauri_mre_crypto_pgp
|
|
73
|
+
|
|
74
|
+
# uv (virtualenv-only install)
|
|
75
|
+
uv pip install swarmauri_mre_crypto_pgp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Usage
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import asyncio
|
|
82
|
+
from pgpy import PGPKey, PGPUID
|
|
83
|
+
from pgpy.constants import (
|
|
84
|
+
CompressionAlgorithm,
|
|
85
|
+
HashAlgorithm,
|
|
86
|
+
KeyFlags,
|
|
87
|
+
PubKeyAlgorithm,
|
|
88
|
+
SymmetricKeyAlgorithm,
|
|
89
|
+
)
|
|
90
|
+
from swarmauri_mre_crypto_pgp import PGPMreCrypto
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
async def main():
|
|
94
|
+
# Generate an OpenPGP key pair with pgpy
|
|
95
|
+
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
|
|
96
|
+
uid = PGPUID.new("Test User", email="test@example.com")
|
|
97
|
+
key.add_uid(
|
|
98
|
+
uid,
|
|
99
|
+
usage={KeyFlags.EncryptCommunications},
|
|
100
|
+
hashes=[HashAlgorithm.SHA256],
|
|
101
|
+
ciphers=[SymmetricKeyAlgorithm.AES256],
|
|
102
|
+
compression=[CompressionAlgorithm.ZLIB],
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# Create references understood by the provider
|
|
106
|
+
pub_ref = {"kind": "pgpy_pub", "pub": key.pubkey}
|
|
107
|
+
priv_ref = {"kind": "pgpy_priv", "priv": key}
|
|
108
|
+
|
|
109
|
+
# Encrypt for many and open with the private key
|
|
110
|
+
mre = PGPMreCrypto()
|
|
111
|
+
pt = b"hello"
|
|
112
|
+
env = await mre.encrypt_for_many([pub_ref], pt)
|
|
113
|
+
rt = await mre.open_for(priv_ref, env)
|
|
114
|
+
print(rt)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
asyncio.run(main())
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Selecting modes
|
|
122
|
+
|
|
123
|
+
`PGPMreCrypto` defaults to `MreMode.ENC_ONCE_HEADERS`. Pass
|
|
124
|
+
`mode=MreMode.SEALED_PER_RECIPIENT` (or the string value) to switch to the
|
|
125
|
+
sealed-per-recipient variant. `PGPSealedCekMreCrypto` always operates in the
|
|
126
|
+
`sealed_cek+aead` mode and will raise when the envelope mode or algorithms do
|
|
127
|
+
not match the expected values.
|
|
128
|
+
|
|
129
|
+
### Re-wrapping envelopes
|
|
130
|
+
|
|
131
|
+
- **Sealed per recipient** – Re-wrapping with additional recipients requires
|
|
132
|
+
`opts["plaintext"]` so the providers can seal the original payload again.
|
|
133
|
+
- **Shared CEK (enc_once / sealed_cek)** – Supply either the decrypted CEK via
|
|
134
|
+
`opts["cek"]` or provide identities capable of opening the envelope through
|
|
135
|
+
`opts["manage_key"]` (composite provider) or
|
|
136
|
+
`opts["opener_identities"]` (sealed CEK provider).
|
|
137
|
+
Enable payload rotation with `opts["rotate_payload_on_revoke"]` to generate a
|
|
138
|
+
fresh CEK when removing recipients.
|
|
139
|
+
|
|
140
|
+
## Entry point
|
|
141
|
+
|
|
142
|
+
Providers are registered under the `swarmauri.mre_cryptos` entry point as
|
|
143
|
+
`PGPSealMreCrypto`, `PGPSealedCekMreCrypto`, and `PGPMreCrypto`.
|
|
144
|
+
|
|
145
|
+
## Want to help?
|
|
146
|
+
|
|
147
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
148
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
149
|
+
that will help you get started.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_mre_crypto_pgp"
|
|
3
|
-
version = "0.3.0.
|
|
3
|
+
version = "0.3.0.dev32"
|
|
4
4
|
description = "OpenPGP sealed-per-recipient MRE provider for Swarmauri"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.10,<3.13"
|
|
8
|
-
authors = [{ name = "
|
|
8
|
+
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
9
9
|
classifiers = [
|
|
10
10
|
"License :: OSI Approved :: Apache Software License",
|
|
11
11
|
"Natural Language :: English",
|
|
@@ -16,12 +16,24 @@ classifiers = [
|
|
|
16
16
|
"Development Status :: 3 - Alpha",
|
|
17
17
|
"Topic :: Security :: Cryptography",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
22
|
]
|
|
20
23
|
dependencies = [
|
|
21
24
|
"swarmauri_core",
|
|
22
25
|
"swarmauri_base",
|
|
23
26
|
"pgpy>=0.6.0",
|
|
24
27
|
]
|
|
28
|
+
keywords = [
|
|
29
|
+
'swarmauri',
|
|
30
|
+
'sdk',
|
|
31
|
+
'standards',
|
|
32
|
+
'mre',
|
|
33
|
+
'crypto',
|
|
34
|
+
'pgp',
|
|
35
|
+
'cryptography',
|
|
36
|
+
]
|
|
25
37
|
|
|
26
38
|
[project.optional-dependencies]
|
|
27
39
|
pgpy = ["pgpy>=0.6.0"]
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_mre_crypto_pgp
|
|
3
|
-
Version: 0.3.0.dev4
|
|
4
|
-
Summary: OpenPGP sealed-per-recipient MRE provider 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
|
-
Provides-Extra: cryptography
|
|
20
|
-
Provides-Extra: pgpy
|
|
21
|
-
Requires-Dist: cbor2 (>=5.4.6) ; extra == "cbor"
|
|
22
|
-
Requires-Dist: cryptography (>=41.0.0) ; extra == "cryptography"
|
|
23
|
-
Requires-Dist: pgpy (>=0.6.0)
|
|
24
|
-
Requires-Dist: pgpy (>=0.6.0) ; extra == "pgpy"
|
|
25
|
-
Requires-Dist: swarmauri_base
|
|
26
|
-
Requires-Dist: swarmauri_core
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
<p align="center">
|
|
32
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
33
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
34
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp/">
|
|
35
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp.svg"/></a>
|
|
36
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
37
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
38
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
39
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_pgp" alt="PyPI - License"/></a>
|
|
40
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
41
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_pgp?label=swarmauri_mre_crypto_pgp&color=green" alt="PyPI - swarmauri_mre_crypto_pgp"/></a>
|
|
42
|
-
</p>
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Swarmauri MRE Crypto PGP
|
|
47
|
-
|
|
48
|
-
OpenPGP-based multi-recipient encryption providers implementing the
|
|
49
|
-
`IMreCrypto` contract. This package exposes three providers:
|
|
50
|
-
|
|
51
|
-
* **PGPSealMreCrypto** – per-recipient sealed payloads
|
|
52
|
-
(`sealed_per_recipient` mode).
|
|
53
|
-
* **PGPSealedCekMreCrypto** – shared AEAD payload with per-recipient sealed
|
|
54
|
-
CEK (`sealed_cek+aead` mode).
|
|
55
|
-
* **PGPMreCrypto** – composite provider supporting both the
|
|
56
|
-
`enc_once+per_recipient_header` and `sealed_per_recipient` modes.
|
|
57
|
-
|
|
58
|
-
All providers use OpenPGP public key encryption via PGPy.
|
|
59
|
-
|
|
60
|
-
### Installation
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pip install swarmauri_mre_crypto_pgp
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Usage
|
|
67
|
-
|
|
68
|
-
```python
|
|
69
|
-
import asyncio
|
|
70
|
-
from pgpy import PGPKey, PGPUID
|
|
71
|
-
from pgpy.constants import (
|
|
72
|
-
CompressionAlgorithm,
|
|
73
|
-
HashAlgorithm,
|
|
74
|
-
KeyFlags,
|
|
75
|
-
PubKeyAlgorithm,
|
|
76
|
-
SymmetricKeyAlgorithm,
|
|
77
|
-
)
|
|
78
|
-
from swarmauri_mre_crypto_pgp import PGPMreCrypto
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
async def main():
|
|
82
|
-
# Generate an OpenPGP key pair with pgpy
|
|
83
|
-
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
|
|
84
|
-
uid = PGPUID.new("Test User", email="test@example.com")
|
|
85
|
-
key.add_uid(
|
|
86
|
-
uid,
|
|
87
|
-
usage={KeyFlags.EncryptCommunications},
|
|
88
|
-
hashes=[HashAlgorithm.SHA256],
|
|
89
|
-
ciphers=[SymmetricKeyAlgorithm.AES256],
|
|
90
|
-
compression=[CompressionAlgorithm.ZLIB],
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
# Create references understood by the provider
|
|
94
|
-
pub_ref = {"kind": "pgpy_pub", "pub": key.pubkey}
|
|
95
|
-
priv_ref = {"kind": "pgpy_priv", "priv": key}
|
|
96
|
-
|
|
97
|
-
# Encrypt for many and open with the private key
|
|
98
|
-
mre = PGPMreCrypto()
|
|
99
|
-
pt = b"hello"
|
|
100
|
-
env = await mre.encrypt_for_many([pub_ref], pt)
|
|
101
|
-
rt = await mre.open_for(priv_ref, env)
|
|
102
|
-
print(rt)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if __name__ == "__main__":
|
|
106
|
-
asyncio.run(main())
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Entry point
|
|
110
|
-
|
|
111
|
-
Providers are registered under the `swarmauri.mre_cryptos` entry-point as
|
|
112
|
-
`PGPSealMreCrypto`, `PGPSealedCekMreCrypto` and `PGPMreCrypto`.
|
|
113
|
-
|
|
114
|
-
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
5
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
6
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_pgp.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
9
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
10
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
11
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_pgp" alt="PyPI - License"/></a>
|
|
12
|
-
<a href="https://pypi.org/project/swarmauri_mre_crypto_pgp/">
|
|
13
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_pgp?label=swarmauri_mre_crypto_pgp&color=green" alt="PyPI - swarmauri_mre_crypto_pgp"/></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Swarmauri MRE Crypto PGP
|
|
19
|
-
|
|
20
|
-
OpenPGP-based multi-recipient encryption providers implementing the
|
|
21
|
-
`IMreCrypto` contract. This package exposes three providers:
|
|
22
|
-
|
|
23
|
-
* **PGPSealMreCrypto** – per-recipient sealed payloads
|
|
24
|
-
(`sealed_per_recipient` mode).
|
|
25
|
-
* **PGPSealedCekMreCrypto** – shared AEAD payload with per-recipient sealed
|
|
26
|
-
CEK (`sealed_cek+aead` mode).
|
|
27
|
-
* **PGPMreCrypto** – composite provider supporting both the
|
|
28
|
-
`enc_once+per_recipient_header` and `sealed_per_recipient` modes.
|
|
29
|
-
|
|
30
|
-
All providers use OpenPGP public key encryption via PGPy.
|
|
31
|
-
|
|
32
|
-
### Installation
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
pip install swarmauri_mre_crypto_pgp
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Usage
|
|
39
|
-
|
|
40
|
-
```python
|
|
41
|
-
import asyncio
|
|
42
|
-
from pgpy import PGPKey, PGPUID
|
|
43
|
-
from pgpy.constants import (
|
|
44
|
-
CompressionAlgorithm,
|
|
45
|
-
HashAlgorithm,
|
|
46
|
-
KeyFlags,
|
|
47
|
-
PubKeyAlgorithm,
|
|
48
|
-
SymmetricKeyAlgorithm,
|
|
49
|
-
)
|
|
50
|
-
from swarmauri_mre_crypto_pgp import PGPMreCrypto
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async def main():
|
|
54
|
-
# Generate an OpenPGP key pair with pgpy
|
|
55
|
-
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
|
|
56
|
-
uid = PGPUID.new("Test User", email="test@example.com")
|
|
57
|
-
key.add_uid(
|
|
58
|
-
uid,
|
|
59
|
-
usage={KeyFlags.EncryptCommunications},
|
|
60
|
-
hashes=[HashAlgorithm.SHA256],
|
|
61
|
-
ciphers=[SymmetricKeyAlgorithm.AES256],
|
|
62
|
-
compression=[CompressionAlgorithm.ZLIB],
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
# Create references understood by the provider
|
|
66
|
-
pub_ref = {"kind": "pgpy_pub", "pub": key.pubkey}
|
|
67
|
-
priv_ref = {"kind": "pgpy_priv", "priv": key}
|
|
68
|
-
|
|
69
|
-
# Encrypt for many and open with the private key
|
|
70
|
-
mre = PGPMreCrypto()
|
|
71
|
-
pt = b"hello"
|
|
72
|
-
env = await mre.encrypt_for_many([pub_ref], pt)
|
|
73
|
-
rt = await mre.open_for(priv_ref, env)
|
|
74
|
-
print(rt)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if __name__ == "__main__":
|
|
78
|
-
asyncio.run(main())
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Entry point
|
|
82
|
-
|
|
83
|
-
Providers are registered under the `swarmauri.mre_cryptos` entry-point as
|
|
84
|
-
`PGPSealMreCrypto`, `PGPSealedCekMreCrypto` and `PGPMreCrypto`.
|
|
85
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|