swarmauri_crypto_pgp 0.2.0.dev4__tar.gz → 0.2.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_crypto_pgp-0.2.0.dev32/PKG-INFO +146 -0
- swarmauri_crypto_pgp-0.2.0.dev32/README.md +118 -0
- {swarmauri_crypto_pgp-0.2.0.dev4 → swarmauri_crypto_pgp-0.2.0.dev32}/pyproject.toml +14 -2
- swarmauri_crypto_pgp-0.2.0.dev4/PKG-INFO +0 -86
- swarmauri_crypto_pgp-0.2.0.dev4/README.md +0 -62
- {swarmauri_crypto_pgp-0.2.0.dev4 → swarmauri_crypto_pgp-0.2.0.dev32}/LICENSE +0 -0
- {swarmauri_crypto_pgp-0.2.0.dev4 → swarmauri_crypto_pgp-0.2.0.dev32}/swarmauri_crypto_pgp/PGPCrypto.py +0 -0
- {swarmauri_crypto_pgp-0.2.0.dev4 → swarmauri_crypto_pgp-0.2.0.dev32}/swarmauri_crypto_pgp/__init__.py +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_crypto_pgp
|
|
3
|
+
Version: 0.2.0.dev32
|
|
4
|
+
Summary: OpenPGP (GnuPG) + AES-GCM crypto provider for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,sdk,standards,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
|
+
Requires-Dist: cryptography (>=41)
|
|
24
|
+
Requires-Dist: python-gnupg (>=0.5.0)
|
|
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_crypto_pgp/">
|
|
33
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
34
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp/">
|
|
35
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp.svg"/></a>
|
|
36
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
37
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
38
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
39
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_pgp" alt="PyPI - License"/></a>
|
|
40
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_pgp?label=swarmauri_crypto_pgp&color=green" alt="PyPI - swarmauri_crypto_pgp"/></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Swarmauri Crypto PGP
|
|
47
|
+
|
|
48
|
+
`PGPCrypto` is an OpenPGP (GnuPG-backed) crypto provider that implements the
|
|
49
|
+
`ICrypto` contract from `swarmauri_core`. It combines modern AEAD primitives
|
|
50
|
+
with OpenPGP public-key operations so that the same component can handle
|
|
51
|
+
symmetrical encryption, public-key key wrapping, and hybrid envelopes.
|
|
52
|
+
|
|
53
|
+
### Features at a glance
|
|
54
|
+
|
|
55
|
+
- **Symmetric AEAD** – AES-256-GCM powers `encrypt` and `decrypt`.
|
|
56
|
+
- **Key wrapping** – `wrap` and `unwrap` delegate to GnuPG to protect random or
|
|
57
|
+
supplied key material with a recipient's public/private key pair.
|
|
58
|
+
- **Hybrid envelopes** – `encrypt_for_many` supports both traditional
|
|
59
|
+
KEM+AEAD (shared ciphertext + wrapped session key) and OpenPGP sealed mode for
|
|
60
|
+
per-recipient ciphertexts.
|
|
61
|
+
- **Sealing convenience** – `seal` and `unseal` provide single-recipient
|
|
62
|
+
OpenPGP public-key encryption without managing the envelope structure.
|
|
63
|
+
|
|
64
|
+
### System requirements
|
|
65
|
+
|
|
66
|
+
- Python 3.10 – 3.13.
|
|
67
|
+
- [GnuPG](https://gnupg.org/) available on the `PATH` (required by
|
|
68
|
+
`python-gnupg`).
|
|
69
|
+
|
|
70
|
+
### Key material expectations
|
|
71
|
+
|
|
72
|
+
- `encrypt` / `decrypt`: `KeyRef.material` must be 16/24/32 bytes for AES-GCM.
|
|
73
|
+
- `wrap` / `encrypt_for_many`: `KeyRef.public` must be ASCII-armored OpenPGP
|
|
74
|
+
public key bytes.
|
|
75
|
+
- `unwrap` / `unseal`: `KeyRef.material` must be ASCII-armored OpenPGP private
|
|
76
|
+
key bytes. Supply a passphrase via `KeyRef.tags["passphrase"]` when needed.
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
Choose the tool that matches your workflow:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# pip
|
|
84
|
+
pip install swarmauri_crypto_pgp
|
|
85
|
+
|
|
86
|
+
# Poetry
|
|
87
|
+
poetry add swarmauri_crypto_pgp
|
|
88
|
+
|
|
89
|
+
# uv
|
|
90
|
+
uv add swarmauri_crypto_pgp
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Quickstart
|
|
94
|
+
|
|
95
|
+
The snippet below mirrors the asynchronous usage exercised in the tests. It
|
|
96
|
+
creates a symmetric `KeyRef`, encrypts plaintext, and decrypts the resulting
|
|
97
|
+
`AEADCiphertext` back to bytes.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import asyncio
|
|
101
|
+
|
|
102
|
+
from swarmauri_crypto_pgp import PGPCrypto
|
|
103
|
+
from swarmauri_core.crypto.types import ExportPolicy, KeyRef, KeyType, KeyUse
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
async def main() -> None:
|
|
107
|
+
crypto = PGPCrypto()
|
|
108
|
+
|
|
109
|
+
# Symmetric key for AES-256-GCM
|
|
110
|
+
sym = KeyRef(
|
|
111
|
+
kid="sym1",
|
|
112
|
+
version=1,
|
|
113
|
+
type=KeyType.SYMMETRIC,
|
|
114
|
+
uses=(KeyUse.ENCRYPT, KeyUse.DECRYPT),
|
|
115
|
+
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
116
|
+
material=b"\x00" * 32,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
ct = await crypto.encrypt(sym, b"hello OpenPGP")
|
|
120
|
+
pt = await crypto.decrypt(sym, ct)
|
|
121
|
+
|
|
122
|
+
print(pt)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
asyncio.run(main())
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Working with recipients
|
|
130
|
+
|
|
131
|
+
- Call `encrypt_for_many` with recipient public keys to either produce an
|
|
132
|
+
AES-GCM ciphertext with OpenPGP-wrapped session keys (default) or
|
|
133
|
+
per-recipient sealed blobs by passing `enc_alg="OpenPGP-SEAL"`.
|
|
134
|
+
- Use `seal` / `unseal` for single-recipient OpenPGP public-key encryption.
|
|
135
|
+
- `wrap` and `unwrap` offer direct access to OpenPGP-based key encapsulation.
|
|
136
|
+
|
|
137
|
+
## Entry point
|
|
138
|
+
|
|
139
|
+
The provider is registered under the `swarmauri.cryptos` entry-point as
|
|
140
|
+
`PGPCrypto`.
|
|
141
|
+
|
|
142
|
+
## Want to help?
|
|
143
|
+
|
|
144
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
145
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
146
|
+
that will help you get started.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
5
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_pgp" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_pgp?label=swarmauri_crypto_pgp&color=green" alt="PyPI - swarmauri_crypto_pgp"/></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Swarmauri Crypto PGP
|
|
19
|
+
|
|
20
|
+
`PGPCrypto` is an OpenPGP (GnuPG-backed) crypto provider that implements the
|
|
21
|
+
`ICrypto` contract from `swarmauri_core`. It combines modern AEAD primitives
|
|
22
|
+
with OpenPGP public-key operations so that the same component can handle
|
|
23
|
+
symmetrical encryption, public-key key wrapping, and hybrid envelopes.
|
|
24
|
+
|
|
25
|
+
### Features at a glance
|
|
26
|
+
|
|
27
|
+
- **Symmetric AEAD** – AES-256-GCM powers `encrypt` and `decrypt`.
|
|
28
|
+
- **Key wrapping** – `wrap` and `unwrap` delegate to GnuPG to protect random or
|
|
29
|
+
supplied key material with a recipient's public/private key pair.
|
|
30
|
+
- **Hybrid envelopes** – `encrypt_for_many` supports both traditional
|
|
31
|
+
KEM+AEAD (shared ciphertext + wrapped session key) and OpenPGP sealed mode for
|
|
32
|
+
per-recipient ciphertexts.
|
|
33
|
+
- **Sealing convenience** – `seal` and `unseal` provide single-recipient
|
|
34
|
+
OpenPGP public-key encryption without managing the envelope structure.
|
|
35
|
+
|
|
36
|
+
### System requirements
|
|
37
|
+
|
|
38
|
+
- Python 3.10 – 3.13.
|
|
39
|
+
- [GnuPG](https://gnupg.org/) available on the `PATH` (required by
|
|
40
|
+
`python-gnupg`).
|
|
41
|
+
|
|
42
|
+
### Key material expectations
|
|
43
|
+
|
|
44
|
+
- `encrypt` / `decrypt`: `KeyRef.material` must be 16/24/32 bytes for AES-GCM.
|
|
45
|
+
- `wrap` / `encrypt_for_many`: `KeyRef.public` must be ASCII-armored OpenPGP
|
|
46
|
+
public key bytes.
|
|
47
|
+
- `unwrap` / `unseal`: `KeyRef.material` must be ASCII-armored OpenPGP private
|
|
48
|
+
key bytes. Supply a passphrase via `KeyRef.tags["passphrase"]` when needed.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Choose the tool that matches your workflow:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# pip
|
|
56
|
+
pip install swarmauri_crypto_pgp
|
|
57
|
+
|
|
58
|
+
# Poetry
|
|
59
|
+
poetry add swarmauri_crypto_pgp
|
|
60
|
+
|
|
61
|
+
# uv
|
|
62
|
+
uv add swarmauri_crypto_pgp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quickstart
|
|
66
|
+
|
|
67
|
+
The snippet below mirrors the asynchronous usage exercised in the tests. It
|
|
68
|
+
creates a symmetric `KeyRef`, encrypts plaintext, and decrypts the resulting
|
|
69
|
+
`AEADCiphertext` back to bytes.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import asyncio
|
|
73
|
+
|
|
74
|
+
from swarmauri_crypto_pgp import PGPCrypto
|
|
75
|
+
from swarmauri_core.crypto.types import ExportPolicy, KeyRef, KeyType, KeyUse
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
async def main() -> None:
|
|
79
|
+
crypto = PGPCrypto()
|
|
80
|
+
|
|
81
|
+
# Symmetric key for AES-256-GCM
|
|
82
|
+
sym = KeyRef(
|
|
83
|
+
kid="sym1",
|
|
84
|
+
version=1,
|
|
85
|
+
type=KeyType.SYMMETRIC,
|
|
86
|
+
uses=(KeyUse.ENCRYPT, KeyUse.DECRYPT),
|
|
87
|
+
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
88
|
+
material=b"\x00" * 32,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
ct = await crypto.encrypt(sym, b"hello OpenPGP")
|
|
92
|
+
pt = await crypto.decrypt(sym, ct)
|
|
93
|
+
|
|
94
|
+
print(pt)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if __name__ == "__main__":
|
|
98
|
+
asyncio.run(main())
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Working with recipients
|
|
102
|
+
|
|
103
|
+
- Call `encrypt_for_many` with recipient public keys to either produce an
|
|
104
|
+
AES-GCM ciphertext with OpenPGP-wrapped session keys (default) or
|
|
105
|
+
per-recipient sealed blobs by passing `enc_alg="OpenPGP-SEAL"`.
|
|
106
|
+
- Use `seal` / `unseal` for single-recipient OpenPGP public-key encryption.
|
|
107
|
+
- `wrap` and `unwrap` offer direct access to OpenPGP-based key encapsulation.
|
|
108
|
+
|
|
109
|
+
## Entry point
|
|
110
|
+
|
|
111
|
+
The provider is registered under the `swarmauri.cryptos` entry-point as
|
|
112
|
+
`PGPCrypto`.
|
|
113
|
+
|
|
114
|
+
## Want to help?
|
|
115
|
+
|
|
116
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
117
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
118
|
+
that will help you get started.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_crypto_pgp"
|
|
3
|
-
version = "0.2.0.
|
|
3
|
+
version = "0.2.0.dev32"
|
|
4
4
|
description = "OpenPGP (GnuPG) + AES-GCM crypto 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,6 +16,9 @@ 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",
|
|
@@ -23,6 +26,14 @@ dependencies = [
|
|
|
23
26
|
"cryptography>=41",
|
|
24
27
|
"python-gnupg>=0.5.0",
|
|
25
28
|
]
|
|
29
|
+
keywords = [
|
|
30
|
+
'swarmauri',
|
|
31
|
+
'sdk',
|
|
32
|
+
'standards',
|
|
33
|
+
'crypto',
|
|
34
|
+
'pgp',
|
|
35
|
+
'cryptography',
|
|
36
|
+
]
|
|
26
37
|
|
|
27
38
|
[tool.uv.sources]
|
|
28
39
|
swarmauri_core = { workspace = true }
|
|
@@ -37,6 +48,7 @@ markers = [
|
|
|
37
48
|
"r8n: Regression tests",
|
|
38
49
|
"acceptance: Acceptance tests",
|
|
39
50
|
"perf: Performance tests",
|
|
51
|
+
"example: Documentation-backed examples",
|
|
40
52
|
]
|
|
41
53
|
timeout = 300
|
|
42
54
|
log_cli = true
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_crypto_pgp
|
|
3
|
-
Version: 0.2.0.dev4
|
|
4
|
-
Summary: OpenPGP (GnuPG) + AES-GCM crypto 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
|
-
Requires-Dist: cryptography (>=41)
|
|
19
|
-
Requires-Dist: python-gnupg (>=0.5.0)
|
|
20
|
-
Requires-Dist: swarmauri_base
|
|
21
|
-
Requires-Dist: swarmauri_core
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
|
|
24
|
-

|
|
25
|
-
|
|
26
|
-
<p align="center">
|
|
27
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
28
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
29
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp/">
|
|
30
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp.svg"/></a>
|
|
31
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
32
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
33
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
34
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_pgp" alt="PyPI - License"/></a>
|
|
35
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
36
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_pgp?label=swarmauri_crypto_pgp&color=green" alt="PyPI - swarmauri_crypto_pgp"/></a>
|
|
37
|
-
</p>
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Swarmauri Crypto PGP
|
|
42
|
-
|
|
43
|
-
OpenPGP (GnuPG-backed) crypto provider implementing the `ICrypto` contract.
|
|
44
|
-
|
|
45
|
-
- Symmetric AEAD: AES-256-GCM
|
|
46
|
-
- Key wrapping: OpenPGP public-key encryption (RSA keys recommended)
|
|
47
|
-
- Hybrid encrypt-for-many supported
|
|
48
|
-
|
|
49
|
-
### Key material expectations
|
|
50
|
-
|
|
51
|
-
- `encrypt`/`decrypt`: `KeyRef.material` must be 16/24/32 bytes for AES-GCM
|
|
52
|
-
- `wrap`/`encrypt_for_many`: `KeyRef.public` must be ASCII-armored OpenPGP public key bytes
|
|
53
|
-
- `unwrap`: `KeyRef.material` must be ASCII-armored OpenPGP private key bytes
|
|
54
|
-
|
|
55
|
-
## Installation
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
pip install swarmauri_crypto_pgp
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Usage
|
|
62
|
-
|
|
63
|
-
```python
|
|
64
|
-
from swarmauri_crypto_pgp import PGPCrypto
|
|
65
|
-
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy
|
|
66
|
-
|
|
67
|
-
crypto = PGPCrypto()
|
|
68
|
-
|
|
69
|
-
# Symmetric key for AEAD
|
|
70
|
-
sym = KeyRef(
|
|
71
|
-
kid="sym1",
|
|
72
|
-
version=1,
|
|
73
|
-
type=KeyType.SYMMETRIC,
|
|
74
|
-
uses=(KeyUse.ENCRYPT, KeyUse.DECRYPT),
|
|
75
|
-
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
76
|
-
material=b"\x00" * 32,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
ct = await crypto.encrypt(sym, b"hello")
|
|
80
|
-
pt = await crypto.decrypt(sym, ct)
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Entry point
|
|
84
|
-
|
|
85
|
-
The provider is registered under the `swarmauri.cryptos` entry-point as `PGPCrypto`.
|
|
86
|
-
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
5
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_crypto_pgp" alt="PyPI - Downloads"/></a>
|
|
6
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_pgp.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
9
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_crypto_pgp" alt="PyPI - Python Version"/></a>
|
|
10
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
11
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_pgp" alt="PyPI - License"/></a>
|
|
12
|
-
<a href="https://pypi.org/project/swarmauri_crypto_pgp/">
|
|
13
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_pgp?label=swarmauri_crypto_pgp&color=green" alt="PyPI - swarmauri_crypto_pgp"/></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Swarmauri Crypto PGP
|
|
19
|
-
|
|
20
|
-
OpenPGP (GnuPG-backed) crypto provider implementing the `ICrypto` contract.
|
|
21
|
-
|
|
22
|
-
- Symmetric AEAD: AES-256-GCM
|
|
23
|
-
- Key wrapping: OpenPGP public-key encryption (RSA keys recommended)
|
|
24
|
-
- Hybrid encrypt-for-many supported
|
|
25
|
-
|
|
26
|
-
### Key material expectations
|
|
27
|
-
|
|
28
|
-
- `encrypt`/`decrypt`: `KeyRef.material` must be 16/24/32 bytes for AES-GCM
|
|
29
|
-
- `wrap`/`encrypt_for_many`: `KeyRef.public` must be ASCII-armored OpenPGP public key bytes
|
|
30
|
-
- `unwrap`: `KeyRef.material` must be ASCII-armored OpenPGP private key bytes
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
pip install swarmauri_crypto_pgp
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
```python
|
|
41
|
-
from swarmauri_crypto_pgp import PGPCrypto
|
|
42
|
-
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy
|
|
43
|
-
|
|
44
|
-
crypto = PGPCrypto()
|
|
45
|
-
|
|
46
|
-
# Symmetric key for AEAD
|
|
47
|
-
sym = KeyRef(
|
|
48
|
-
kid="sym1",
|
|
49
|
-
version=1,
|
|
50
|
-
type=KeyType.SYMMETRIC,
|
|
51
|
-
uses=(KeyUse.ENCRYPT, KeyUse.DECRYPT),
|
|
52
|
-
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
53
|
-
material=b"\x00" * 32,
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
ct = await crypto.encrypt(sym, b"hello")
|
|
57
|
-
pt = await crypto.decrypt(sym, ct)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Entry point
|
|
61
|
-
|
|
62
|
-
The provider is registered under the `swarmauri.cryptos` entry-point as `PGPCrypto`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|