quantacipher 0.1.1__tar.gz → 0.2.0__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.
- quantacipher-0.2.0/LICENSE +21 -0
- quantacipher-0.2.0/PKG-INFO +227 -0
- quantacipher-0.2.0/README.md +213 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/pyproject.toml +4 -2
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-core/Cargo.toml +2 -2
- quantacipher-0.2.0/quantacipher-core/LICENSE +21 -0
- quantacipher-0.2.0/quantacipher-core/README.md +137 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/Cargo.lock +2 -2
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/Cargo.toml +2 -2
- quantacipher-0.2.0/quantacipher-python/LICENSE +21 -0
- quantacipher-0.2.0/quantacipher-python/README.md +213 -0
- quantacipher-0.1.1/PKG-INFO +0 -8
- quantacipher-0.1.1/quantacipher-core/README.md +0 -45
- quantacipher-0.1.1/quantacipher-python/README.md +0 -12
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-core/src/error.rs +0 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-core/src/lib.rs +0 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/.gitignore +0 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/quantacipher/__init__.py +0 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/src/lib.rs +0 -0
- {quantacipher-0.1.1 → quantacipher-0.2.0}/quantacipher-python/test.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024–2026 QuantaLabs Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantacipher
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Requires-Dist: requests>=2.0.0
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Summary: Zero-trust PQC encryption library for Python
|
|
7
|
+
Author: QuantaLabs
|
|
8
|
+
License: MIT
|
|
9
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
10
|
+
Project-URL: Documentation, https://quantachain.gitbook.io/quantacipher
|
|
11
|
+
Project-URL: Homepage, https://www.quantacipher.com
|
|
12
|
+
Project-URL: Repository, https://github.com/xaexaex/quantacipher
|
|
13
|
+
|
|
14
|
+
<div align="center">
|
|
15
|
+
|
|
16
|
+
<h1>quantacipher</h1>
|
|
17
|
+
|
|
18
|
+
<p><strong>Zero-Trust Post-Quantum Encryption SDK for Python</strong><br/>
|
|
19
|
+
NIST ML-KEM (Kyber-1024) · AES-256-GCM · Native Rust Extension · Dual-Mode</p>
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/quantacipher)
|
|
22
|
+
[](https://pypi.org/project/quantacipher)
|
|
23
|
+
[](https://pypi.org/project/quantacipher)
|
|
24
|
+
[](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
25
|
+
[](https://pyo3.rs)
|
|
26
|
+
|
|
27
|
+
[Platform](https://www.quantacipher.com) · [API Docs](https://quantachain.gitbook.io/quantacipher) · [GitHub](https://github.com/xaexaex/quantacipher)
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## What is this?
|
|
34
|
+
|
|
35
|
+
`quantacipher` is the official Python SDK for the [QuantaCipher](https://www.quantacipher.com) platform — a zero-trust, API-first post-quantum encryption system.
|
|
36
|
+
|
|
37
|
+
Under the hood, it runs a **Rust cryptographic engine compiled to a native Python extension** via [PyO3](https://pyo3.rs). All encryption and decryption happens **100% locally** inside your Python process. Plaintext never leaves your runtime. The QuantaCipher API Gateway only ever sees ciphertext.
|
|
38
|
+
|
|
39
|
+
No external crypto dependencies. No C++ build steps. Pure native performance.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install quantacipher
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Requires Python 3.8+. Pre-built wheels are available for Linux, macOS, and Windows.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Initialization
|
|
54
|
+
|
|
55
|
+
Get an API key from your [QuantaCipher Dashboard](https://www.quantacipher.com).
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from quantacipher import QuantaCipher
|
|
59
|
+
|
|
60
|
+
sdk = QuantaCipher(
|
|
61
|
+
api_key="qz_live_your_key_here",
|
|
62
|
+
# gateway_url is optional — defaults to https://api.quantacipher.com/v1/ingest
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Mode 1 — Vault Mode (Permanent Sealing)
|
|
69
|
+
|
|
70
|
+
> Seal data forever. No decryption possible. Designed for HIPAA audit logs, compliance records, and tamper-proof audit trails.
|
|
71
|
+
|
|
72
|
+
**How it works:**
|
|
73
|
+
1. An ephemeral Kyber-1024 keypair is generated locally inside the Rust engine
|
|
74
|
+
2. Data is encrypted using the ephemeral public key (KEM shared secret → AES-256-GCM)
|
|
75
|
+
3. The private key is **immediately and permanently discarded** from memory
|
|
76
|
+
4. The `QZ_VAULT_V1:...` ciphertext is returned — undecryptable by anyone, including QuantaCipher
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import json
|
|
80
|
+
|
|
81
|
+
audit_log = json.dumps({
|
|
82
|
+
"user_id": "U-00987",
|
|
83
|
+
"action": "FUNDS_TRANSFER",
|
|
84
|
+
"amount": 50000.00,
|
|
85
|
+
"timestamp": "2026-07-25T10:30:00Z",
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
# Encrypt locally — private key is gone the moment this returns
|
|
89
|
+
ciphertext = sdk.encrypt_vault(audit_log)
|
|
90
|
+
# → "QZ_VAULT_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
91
|
+
|
|
92
|
+
print(ciphertext[:60], "...")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Encrypt and send to the gateway in one call:**
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
receipt = sdk.vault_data(audit_log, metadata={"source": "payment_service", "type": "hipaa"})
|
|
99
|
+
|
|
100
|
+
print(receipt["id"]) # "qz_rcpt_1753429812_abc123"
|
|
101
|
+
print(receipt["bytesSecured"]) # 156
|
|
102
|
+
print(receipt["encryptionScheme"]) # "Kyber-1024 + AES-256-GCM"
|
|
103
|
+
print(receipt["timestamp"]) # ISO 8601
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
> There is **no `decrypt_vault`**. This is the guarantee — not a bug.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Mode 2 — Secure Mode (End-to-End Encryption)
|
|
111
|
+
|
|
112
|
+
> Encrypt data your users need to read back. You hold the keys. QuantaCipher never sees them.
|
|
113
|
+
|
|
114
|
+
**How it works:**
|
|
115
|
+
1. A persistent Kyber-1024 keypair is generated locally — you store the private key
|
|
116
|
+
2. Data is encrypted using the public key — only the holder of the matching private key can decrypt
|
|
117
|
+
3. Only ciphertext travels over the network
|
|
118
|
+
4. Decryption happens locally — private key never leaves your application
|
|
119
|
+
|
|
120
|
+
### Step 1 — Generate a Keypair
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
keys = sdk.generate_keypair()
|
|
124
|
+
|
|
125
|
+
# keys["publicKey"] → base64 Kyber-1024 public key (safe to share)
|
|
126
|
+
# keys["privateKey"] → base64 Kyber-1024 private key (NEVER share — store securely)
|
|
127
|
+
# keys["algorithm"] → "Kyber-1024"
|
|
128
|
+
# keys["version"] → "1.0"
|
|
129
|
+
|
|
130
|
+
print("Store the private key securely. QuantaCipher never has it.")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 2 — Encrypt
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
document = json.dumps({
|
|
137
|
+
"patient_id": "P-00123",
|
|
138
|
+
"diagnosis": "Confidential Medical Information",
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
ciphertext = sdk.encrypt_secure(document, keys["publicKey"])
|
|
142
|
+
# → "QZ_SECURE_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Step 3 — Decrypt (locally)
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
plaintext = sdk.decrypt_secure(ciphertext, keys["privateKey"])
|
|
149
|
+
doc = json.loads(plaintext)
|
|
150
|
+
# doc["diagnosis"] == "Confidential Medical Information"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Wrong key = immediate rejection:**
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
wrong_keys = sdk.generate_keypair()
|
|
157
|
+
try:
|
|
158
|
+
sdk.decrypt_secure(ciphertext, wrong_keys["privateKey"])
|
|
159
|
+
except Exception as e:
|
|
160
|
+
print(e) # QuantaCipher Error: Kyber decapsulation failed (wrong key?)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Encrypt + send to gateway:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
receipt = sdk.secure_data(document, keys["publicKey"], metadata={"user_id": "U-001"})
|
|
167
|
+
# receipt["id"], receipt["bytesSecured"], etc.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Low-Level API (without class)
|
|
173
|
+
|
|
174
|
+
For simple use cases, you can call the core functions directly without instantiating the class:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from quantacipher import generate_keypair, vault_encrypt, secure_encrypt, secure_decrypt
|
|
178
|
+
|
|
179
|
+
keys = generate_keypair()
|
|
180
|
+
ct = secure_encrypt("Hello, quantum world!", keys["publicKey"])
|
|
181
|
+
pt = secure_decrypt(ct, keys["privateKey"])
|
|
182
|
+
# pt == "Hello, quantum world!"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## API Reference
|
|
188
|
+
|
|
189
|
+
### `QuantaCipher(api_key, gateway_url=None)`
|
|
190
|
+
|
|
191
|
+
### Instance Methods
|
|
192
|
+
|
|
193
|
+
| Method | Description |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `generate_keypair()` | Generate a Kyber-1024 keypair locally → `dict` |
|
|
196
|
+
| `encrypt_vault(plaintext)` | Vault Mode encryption (ephemeral key, no decrypt) → `str` |
|
|
197
|
+
| `encrypt_secure(plaintext, public_key_b64)` | Secure Mode encryption → `str` |
|
|
198
|
+
| `decrypt_secure(ciphertext, private_key_b64)` | Secure Mode local decryption → `str` |
|
|
199
|
+
| `vault_data(plaintext, metadata=None)` | Vault Mode + send to gateway → `dict` (receipt) |
|
|
200
|
+
| `secure_data(plaintext, public_key_b64, metadata=None)` | Secure Mode + send to gateway → `dict` (receipt) |
|
|
201
|
+
| `send_to_gateway(ciphertext, metadata=None)` | Send any ciphertext for a receipt → `dict` |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Payload Format
|
|
206
|
+
|
|
207
|
+
All QuantaCipher ciphertexts are portable string tokens — versionable and cross-runtime compatible:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
QZ_VAULT_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
211
|
+
QZ_SECURE_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
A ciphertext encrypted by the Python SDK can be sent to a JS application or the gateway interchangeably — the format is runtime-agnostic.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT — see [LICENSE](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
<div align="center">
|
|
225
|
+
Built by <a href="https://quantalabs.cc"><strong>QuantaLabs</strong></a> · <a href="https://www.quantacipher.com">quantacipher.com</a>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1>quantacipher</h1>
|
|
4
|
+
|
|
5
|
+
<p><strong>Zero-Trust Post-Quantum Encryption SDK for Python</strong><br/>
|
|
6
|
+
NIST ML-KEM (Kyber-1024) · AES-256-GCM · Native Rust Extension · Dual-Mode</p>
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/quantacipher)
|
|
9
|
+
[](https://pypi.org/project/quantacipher)
|
|
10
|
+
[](https://pypi.org/project/quantacipher)
|
|
11
|
+
[](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
12
|
+
[](https://pyo3.rs)
|
|
13
|
+
|
|
14
|
+
[Platform](https://www.quantacipher.com) · [API Docs](https://quantachain.gitbook.io/quantacipher) · [GitHub](https://github.com/xaexaex/quantacipher)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is this?
|
|
21
|
+
|
|
22
|
+
`quantacipher` is the official Python SDK for the [QuantaCipher](https://www.quantacipher.com) platform — a zero-trust, API-first post-quantum encryption system.
|
|
23
|
+
|
|
24
|
+
Under the hood, it runs a **Rust cryptographic engine compiled to a native Python extension** via [PyO3](https://pyo3.rs). All encryption and decryption happens **100% locally** inside your Python process. Plaintext never leaves your runtime. The QuantaCipher API Gateway only ever sees ciphertext.
|
|
25
|
+
|
|
26
|
+
No external crypto dependencies. No C++ build steps. Pure native performance.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install quantacipher
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.8+. Pre-built wheels are available for Linux, macOS, and Windows.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Initialization
|
|
41
|
+
|
|
42
|
+
Get an API key from your [QuantaCipher Dashboard](https://www.quantacipher.com).
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from quantacipher import QuantaCipher
|
|
46
|
+
|
|
47
|
+
sdk = QuantaCipher(
|
|
48
|
+
api_key="qz_live_your_key_here",
|
|
49
|
+
# gateway_url is optional — defaults to https://api.quantacipher.com/v1/ingest
|
|
50
|
+
)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Mode 1 — Vault Mode (Permanent Sealing)
|
|
56
|
+
|
|
57
|
+
> Seal data forever. No decryption possible. Designed for HIPAA audit logs, compliance records, and tamper-proof audit trails.
|
|
58
|
+
|
|
59
|
+
**How it works:**
|
|
60
|
+
1. An ephemeral Kyber-1024 keypair is generated locally inside the Rust engine
|
|
61
|
+
2. Data is encrypted using the ephemeral public key (KEM shared secret → AES-256-GCM)
|
|
62
|
+
3. The private key is **immediately and permanently discarded** from memory
|
|
63
|
+
4. The `QZ_VAULT_V1:...` ciphertext is returned — undecryptable by anyone, including QuantaCipher
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import json
|
|
67
|
+
|
|
68
|
+
audit_log = json.dumps({
|
|
69
|
+
"user_id": "U-00987",
|
|
70
|
+
"action": "FUNDS_TRANSFER",
|
|
71
|
+
"amount": 50000.00,
|
|
72
|
+
"timestamp": "2026-07-25T10:30:00Z",
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
# Encrypt locally — private key is gone the moment this returns
|
|
76
|
+
ciphertext = sdk.encrypt_vault(audit_log)
|
|
77
|
+
# → "QZ_VAULT_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
78
|
+
|
|
79
|
+
print(ciphertext[:60], "...")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Encrypt and send to the gateway in one call:**
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
receipt = sdk.vault_data(audit_log, metadata={"source": "payment_service", "type": "hipaa"})
|
|
86
|
+
|
|
87
|
+
print(receipt["id"]) # "qz_rcpt_1753429812_abc123"
|
|
88
|
+
print(receipt["bytesSecured"]) # 156
|
|
89
|
+
print(receipt["encryptionScheme"]) # "Kyber-1024 + AES-256-GCM"
|
|
90
|
+
print(receipt["timestamp"]) # ISO 8601
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> There is **no `decrypt_vault`**. This is the guarantee — not a bug.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Mode 2 — Secure Mode (End-to-End Encryption)
|
|
98
|
+
|
|
99
|
+
> Encrypt data your users need to read back. You hold the keys. QuantaCipher never sees them.
|
|
100
|
+
|
|
101
|
+
**How it works:**
|
|
102
|
+
1. A persistent Kyber-1024 keypair is generated locally — you store the private key
|
|
103
|
+
2. Data is encrypted using the public key — only the holder of the matching private key can decrypt
|
|
104
|
+
3. Only ciphertext travels over the network
|
|
105
|
+
4. Decryption happens locally — private key never leaves your application
|
|
106
|
+
|
|
107
|
+
### Step 1 — Generate a Keypair
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
keys = sdk.generate_keypair()
|
|
111
|
+
|
|
112
|
+
# keys["publicKey"] → base64 Kyber-1024 public key (safe to share)
|
|
113
|
+
# keys["privateKey"] → base64 Kyber-1024 private key (NEVER share — store securely)
|
|
114
|
+
# keys["algorithm"] → "Kyber-1024"
|
|
115
|
+
# keys["version"] → "1.0"
|
|
116
|
+
|
|
117
|
+
print("Store the private key securely. QuantaCipher never has it.")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Step 2 — Encrypt
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
document = json.dumps({
|
|
124
|
+
"patient_id": "P-00123",
|
|
125
|
+
"diagnosis": "Confidential Medical Information",
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
ciphertext = sdk.encrypt_secure(document, keys["publicKey"])
|
|
129
|
+
# → "QZ_SECURE_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 3 — Decrypt (locally)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
plaintext = sdk.decrypt_secure(ciphertext, keys["privateKey"])
|
|
136
|
+
doc = json.loads(plaintext)
|
|
137
|
+
# doc["diagnosis"] == "Confidential Medical Information"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Wrong key = immediate rejection:**
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
wrong_keys = sdk.generate_keypair()
|
|
144
|
+
try:
|
|
145
|
+
sdk.decrypt_secure(ciphertext, wrong_keys["privateKey"])
|
|
146
|
+
except Exception as e:
|
|
147
|
+
print(e) # QuantaCipher Error: Kyber decapsulation failed (wrong key?)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Encrypt + send to gateway:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
receipt = sdk.secure_data(document, keys["publicKey"], metadata={"user_id": "U-001"})
|
|
154
|
+
# receipt["id"], receipt["bytesSecured"], etc.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Low-Level API (without class)
|
|
160
|
+
|
|
161
|
+
For simple use cases, you can call the core functions directly without instantiating the class:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from quantacipher import generate_keypair, vault_encrypt, secure_encrypt, secure_decrypt
|
|
165
|
+
|
|
166
|
+
keys = generate_keypair()
|
|
167
|
+
ct = secure_encrypt("Hello, quantum world!", keys["publicKey"])
|
|
168
|
+
pt = secure_decrypt(ct, keys["privateKey"])
|
|
169
|
+
# pt == "Hello, quantum world!"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## API Reference
|
|
175
|
+
|
|
176
|
+
### `QuantaCipher(api_key, gateway_url=None)`
|
|
177
|
+
|
|
178
|
+
### Instance Methods
|
|
179
|
+
|
|
180
|
+
| Method | Description |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `generate_keypair()` | Generate a Kyber-1024 keypair locally → `dict` |
|
|
183
|
+
| `encrypt_vault(plaintext)` | Vault Mode encryption (ephemeral key, no decrypt) → `str` |
|
|
184
|
+
| `encrypt_secure(plaintext, public_key_b64)` | Secure Mode encryption → `str` |
|
|
185
|
+
| `decrypt_secure(ciphertext, private_key_b64)` | Secure Mode local decryption → `str` |
|
|
186
|
+
| `vault_data(plaintext, metadata=None)` | Vault Mode + send to gateway → `dict` (receipt) |
|
|
187
|
+
| `secure_data(plaintext, public_key_b64, metadata=None)` | Secure Mode + send to gateway → `dict` (receipt) |
|
|
188
|
+
| `send_to_gateway(ciphertext, metadata=None)` | Send any ciphertext for a receipt → `dict` |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Payload Format
|
|
193
|
+
|
|
194
|
+
All QuantaCipher ciphertexts are portable string tokens — versionable and cross-runtime compatible:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
QZ_VAULT_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
198
|
+
QZ_SECURE_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
A ciphertext encrypted by the Python SDK can be sent to a JS application or the gateway interchangeably — the format is runtime-agnostic.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT — see [LICENSE](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
<div align="center">
|
|
212
|
+
Built by <a href="https://quantalabs.cc"><strong>QuantaLabs</strong></a> · <a href="https://www.quantacipher.com">quantacipher.com</a>
|
|
213
|
+
</div>
|
|
@@ -4,11 +4,13 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantacipher"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Zero-trust PQC encryption library for Python"
|
|
9
9
|
authors = [{ name = "QuantaLabs" }]
|
|
10
10
|
license = { text = "MIT" }
|
|
11
|
-
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
urls = { Repository = "https://github.com/xaexaex/quantacipher", Homepage = "https://www.quantacipher.com", Documentation = "https://quantachain.gitbook.io/quantacipher" }
|
|
12
14
|
dependencies = [
|
|
13
15
|
"requests>=2.0.0"
|
|
14
16
|
]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "quantacipher-core"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Zero-trust PQC (Kyber) encryption core"
|
|
6
6
|
repository = "https://github.com/xaexaex/quantacipher"
|
|
7
7
|
license = "MIT"
|
|
8
|
-
authors = ["QuantaLabs"]
|
|
9
8
|
readme = "README.md"
|
|
9
|
+
authors = ["QuantaLabs"]
|
|
10
10
|
|
|
11
11
|
[dependencies]
|
|
12
12
|
base64 = "0.21"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024–2026 QuantaLabs Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1>quantacipher-core</h1>
|
|
4
|
+
|
|
5
|
+
<p><strong>Pure Rust cryptographic engine for Zero-Trust Post-Quantum Encryption</strong><br/>
|
|
6
|
+
NIST ML-KEM (Kyber-1024) · AES-256-GCM · KEM/DEM Hybrid · Dual-Mode Architecture</p>
|
|
7
|
+
|
|
8
|
+
[](https://crates.io/crates/quantacipher-core)
|
|
9
|
+
[](https://crates.io/crates/quantacipher-core)
|
|
10
|
+
[](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
11
|
+
[](https://www.rust-lang.org/)
|
|
12
|
+
|
|
13
|
+
[Platform](https://www.quantacipher.com) · [API Docs](https://quantachain.gitbook.io/quantacipher) · [GitHub](https://github.com/xaexaex/quantacipher)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## What is this?
|
|
20
|
+
|
|
21
|
+
`quantacipher-core` is the pure Rust cryptographic engine underlying the [QuantaCipher](https://www.quantacipher.com) platform. It implements a **KEM/DEM (Key Encapsulation Mechanism / Data Encapsulation Mechanism) hybrid scheme**:
|
|
22
|
+
|
|
23
|
+
- **KEM layer:** NIST ML-KEM (Kyber-1024, FIPS 203) — establishes a post-quantum shared secret
|
|
24
|
+
- **DEM layer:** AES-256-GCM — encrypts actual data using the shared secret as the symmetric key
|
|
25
|
+
|
|
26
|
+
This library is the single source of truth for cryptographic logic. It is compiled to:
|
|
27
|
+
- **WebAssembly** via `wasm-bindgen` → [`quantacipher-wasm`](https://www.npmjs.com/package/quantacipher-wasm) on npm
|
|
28
|
+
- **Native Python extension** via `pyo3` + `maturin` → [`quantacipher`](https://pypi.org/project/quantacipher) on PyPI
|
|
29
|
+
|
|
30
|
+
> **Most users should use the platform SDKs, not this crate directly.** This crate is intended for Rust applications or projects that need to embed the crypto engine as a native dependency.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```toml
|
|
37
|
+
[dependencies]
|
|
38
|
+
quantacipher-core = "0.1"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```rust
|
|
46
|
+
use quantacipher_core::{generate_keypair, vault_encrypt, secure_encrypt, secure_decrypt};
|
|
47
|
+
|
|
48
|
+
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
49
|
+
|
|
50
|
+
// ── VAULT MODE: Permanent sealing ─────────────────────────────
|
|
51
|
+
// Ephemeral keypair generated and discarded inside this call.
|
|
52
|
+
// The resulting ciphertext cannot be decrypted by anyone.
|
|
53
|
+
let sealed = vault_encrypt("Sensitive audit log entry")?;
|
|
54
|
+
// → "QZ_VAULT_V1:..."
|
|
55
|
+
println!("Sealed: {}", &sealed[..60]);
|
|
56
|
+
|
|
57
|
+
// ── SECURE MODE: End-to-end encryption ────────────────────────
|
|
58
|
+
let (public_key, private_key) = generate_keypair()?;
|
|
59
|
+
|
|
60
|
+
let ciphertext = secure_encrypt("Confidential enterprise data", &public_key)?;
|
|
61
|
+
// → "QZ_SECURE_V1:..."
|
|
62
|
+
|
|
63
|
+
let plaintext = secure_decrypt(&ciphertext, &private_key)?;
|
|
64
|
+
assert_eq!(plaintext, "Confidential enterprise data");
|
|
65
|
+
println!("Round-trip successful");
|
|
66
|
+
|
|
67
|
+
Ok(())
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## API
|
|
74
|
+
|
|
75
|
+
### `generate_keypair() -> Result<(String, String), QuantaCipherError>`
|
|
76
|
+
|
|
77
|
+
Generates a Kyber-1024 keypair. Returns `(public_key_b64, private_key_b64)` — both are base64-encoded.
|
|
78
|
+
|
|
79
|
+
### `vault_encrypt(plaintext: &str) -> Result<String, QuantaCipherError>`
|
|
80
|
+
|
|
81
|
+
Encrypts data in **Vault Mode**. Generates an ephemeral keypair internally, encrypts the data, then deterministically drops the private key. Returns a `QZ_VAULT_V1:...` payload. No decryption is ever possible.
|
|
82
|
+
|
|
83
|
+
### `secure_encrypt(plaintext: &str, public_key_b64: &str) -> Result<String, QuantaCipherError>`
|
|
84
|
+
|
|
85
|
+
Encrypts data in **Secure Mode** using the caller-provided public key. Returns a `QZ_SECURE_V1:...` payload decryptable only by the holder of the matching private key.
|
|
86
|
+
|
|
87
|
+
### `secure_decrypt(ciphertext: &str, private_key_b64: &str) -> Result<String, QuantaCipherError>`
|
|
88
|
+
|
|
89
|
+
Decrypts a `QZ_SECURE_V1:...` payload using the private key. All decryption happens locally.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Cryptographic Details
|
|
94
|
+
|
|
95
|
+
| Property | Value |
|
|
96
|
+
|---|---|
|
|
97
|
+
| KEM Algorithm | CRYSTALS-Kyber-1024 (NIST FIPS 203, ML-KEM) |
|
|
98
|
+
| Symmetric Cipher | AES-256-GCM |
|
|
99
|
+
| Shared Secret Size | 32 bytes |
|
|
100
|
+
| Public Key Size | 1568 bytes |
|
|
101
|
+
| Private Key Size | 3168 bytes |
|
|
102
|
+
| Kyber Ciphertext Size | 1568 bytes |
|
|
103
|
+
| Key Encoding | Base64 (standard) |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Payload Format
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
QZ_VAULT_V1 : <base64 Kyber-1024 CT> : <base64 12-byte AES nonce> : <base64 AES-256-GCM CT>
|
|
111
|
+
QZ_SECURE_V1 : <base64 Kyber-1024 CT> : <base64 12-byte AES nonce> : <base64 AES-256-GCM CT>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Payloads are runtime-agnostic — a payload created by this Rust crate can be sent to and validated by `quantacipher-wasm` (JS), `quantacipher` (Python), or the QuantaCipher Gateway interchangeably.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Dependencies
|
|
119
|
+
|
|
120
|
+
```toml
|
|
121
|
+
pqc_kyber = "0.7.1" # Kyber-1024 KEM
|
|
122
|
+
aes-gcm = "0.10" # AES-256-GCM AEAD
|
|
123
|
+
base64 = "0.21" # Payload encoding
|
|
124
|
+
rand = "0.8" # OS RNG
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT — see [LICENSE](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
<div align="center">
|
|
136
|
+
Built by <a href="https://quantalabs.cc"><strong>QuantaLabs</strong></a> · <a href="https://www.quantacipher.com">quantacipher.com</a>
|
|
137
|
+
</div>
|
|
@@ -324,7 +324,7 @@ dependencies = [
|
|
|
324
324
|
|
|
325
325
|
[[package]]
|
|
326
326
|
name = "quantacipher-core"
|
|
327
|
-
version = "0.
|
|
327
|
+
version = "0.2.0"
|
|
328
328
|
dependencies = [
|
|
329
329
|
"aes-gcm",
|
|
330
330
|
"base64",
|
|
@@ -334,7 +334,7 @@ dependencies = [
|
|
|
334
334
|
|
|
335
335
|
[[package]]
|
|
336
336
|
name = "quantacipher-python"
|
|
337
|
-
version = "0.
|
|
337
|
+
version = "0.2.0"
|
|
338
338
|
dependencies = [
|
|
339
339
|
"pyo3",
|
|
340
340
|
"quantacipher-core",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "quantacipher-python"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Zero-trust PQC (Kyber) encryption Python bindings"
|
|
6
6
|
repository = "https://github.com/xaexaex/quantacipher"
|
|
7
7
|
license = "MIT"
|
|
8
|
-
authors = ["QuantaLabs"]
|
|
9
8
|
readme = "README.md"
|
|
9
|
+
authors = ["QuantaLabs"]
|
|
10
10
|
|
|
11
11
|
[lib]
|
|
12
12
|
name = "_quantacipher_core"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024–2026 QuantaLabs Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1>quantacipher</h1>
|
|
4
|
+
|
|
5
|
+
<p><strong>Zero-Trust Post-Quantum Encryption SDK for Python</strong><br/>
|
|
6
|
+
NIST ML-KEM (Kyber-1024) · AES-256-GCM · Native Rust Extension · Dual-Mode</p>
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/quantacipher)
|
|
9
|
+
[](https://pypi.org/project/quantacipher)
|
|
10
|
+
[](https://pypi.org/project/quantacipher)
|
|
11
|
+
[](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
12
|
+
[](https://pyo3.rs)
|
|
13
|
+
|
|
14
|
+
[Platform](https://www.quantacipher.com) · [API Docs](https://quantachain.gitbook.io/quantacipher) · [GitHub](https://github.com/xaexaex/quantacipher)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is this?
|
|
21
|
+
|
|
22
|
+
`quantacipher` is the official Python SDK for the [QuantaCipher](https://www.quantacipher.com) platform — a zero-trust, API-first post-quantum encryption system.
|
|
23
|
+
|
|
24
|
+
Under the hood, it runs a **Rust cryptographic engine compiled to a native Python extension** via [PyO3](https://pyo3.rs). All encryption and decryption happens **100% locally** inside your Python process. Plaintext never leaves your runtime. The QuantaCipher API Gateway only ever sees ciphertext.
|
|
25
|
+
|
|
26
|
+
No external crypto dependencies. No C++ build steps. Pure native performance.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install quantacipher
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.8+. Pre-built wheels are available for Linux, macOS, and Windows.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Initialization
|
|
41
|
+
|
|
42
|
+
Get an API key from your [QuantaCipher Dashboard](https://www.quantacipher.com).
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from quantacipher import QuantaCipher
|
|
46
|
+
|
|
47
|
+
sdk = QuantaCipher(
|
|
48
|
+
api_key="qz_live_your_key_here",
|
|
49
|
+
# gateway_url is optional — defaults to https://api.quantacipher.com/v1/ingest
|
|
50
|
+
)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Mode 1 — Vault Mode (Permanent Sealing)
|
|
56
|
+
|
|
57
|
+
> Seal data forever. No decryption possible. Designed for HIPAA audit logs, compliance records, and tamper-proof audit trails.
|
|
58
|
+
|
|
59
|
+
**How it works:**
|
|
60
|
+
1. An ephemeral Kyber-1024 keypair is generated locally inside the Rust engine
|
|
61
|
+
2. Data is encrypted using the ephemeral public key (KEM shared secret → AES-256-GCM)
|
|
62
|
+
3. The private key is **immediately and permanently discarded** from memory
|
|
63
|
+
4. The `QZ_VAULT_V1:...` ciphertext is returned — undecryptable by anyone, including QuantaCipher
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import json
|
|
67
|
+
|
|
68
|
+
audit_log = json.dumps({
|
|
69
|
+
"user_id": "U-00987",
|
|
70
|
+
"action": "FUNDS_TRANSFER",
|
|
71
|
+
"amount": 50000.00,
|
|
72
|
+
"timestamp": "2026-07-25T10:30:00Z",
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
# Encrypt locally — private key is gone the moment this returns
|
|
76
|
+
ciphertext = sdk.encrypt_vault(audit_log)
|
|
77
|
+
# → "QZ_VAULT_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
78
|
+
|
|
79
|
+
print(ciphertext[:60], "...")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Encrypt and send to the gateway in one call:**
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
receipt = sdk.vault_data(audit_log, metadata={"source": "payment_service", "type": "hipaa"})
|
|
86
|
+
|
|
87
|
+
print(receipt["id"]) # "qz_rcpt_1753429812_abc123"
|
|
88
|
+
print(receipt["bytesSecured"]) # 156
|
|
89
|
+
print(receipt["encryptionScheme"]) # "Kyber-1024 + AES-256-GCM"
|
|
90
|
+
print(receipt["timestamp"]) # ISO 8601
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> There is **no `decrypt_vault`**. This is the guarantee — not a bug.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Mode 2 — Secure Mode (End-to-End Encryption)
|
|
98
|
+
|
|
99
|
+
> Encrypt data your users need to read back. You hold the keys. QuantaCipher never sees them.
|
|
100
|
+
|
|
101
|
+
**How it works:**
|
|
102
|
+
1. A persistent Kyber-1024 keypair is generated locally — you store the private key
|
|
103
|
+
2. Data is encrypted using the public key — only the holder of the matching private key can decrypt
|
|
104
|
+
3. Only ciphertext travels over the network
|
|
105
|
+
4. Decryption happens locally — private key never leaves your application
|
|
106
|
+
|
|
107
|
+
### Step 1 — Generate a Keypair
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
keys = sdk.generate_keypair()
|
|
111
|
+
|
|
112
|
+
# keys["publicKey"] → base64 Kyber-1024 public key (safe to share)
|
|
113
|
+
# keys["privateKey"] → base64 Kyber-1024 private key (NEVER share — store securely)
|
|
114
|
+
# keys["algorithm"] → "Kyber-1024"
|
|
115
|
+
# keys["version"] → "1.0"
|
|
116
|
+
|
|
117
|
+
print("Store the private key securely. QuantaCipher never has it.")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Step 2 — Encrypt
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
document = json.dumps({
|
|
124
|
+
"patient_id": "P-00123",
|
|
125
|
+
"diagnosis": "Confidential Medical Information",
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
ciphertext = sdk.encrypt_secure(document, keys["publicKey"])
|
|
129
|
+
# → "QZ_SECURE_V1:BASE64_KYBER_CT:BASE64_NONCE:BASE64_AES_CT"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 3 — Decrypt (locally)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
plaintext = sdk.decrypt_secure(ciphertext, keys["privateKey"])
|
|
136
|
+
doc = json.loads(plaintext)
|
|
137
|
+
# doc["diagnosis"] == "Confidential Medical Information"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Wrong key = immediate rejection:**
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
wrong_keys = sdk.generate_keypair()
|
|
144
|
+
try:
|
|
145
|
+
sdk.decrypt_secure(ciphertext, wrong_keys["privateKey"])
|
|
146
|
+
except Exception as e:
|
|
147
|
+
print(e) # QuantaCipher Error: Kyber decapsulation failed (wrong key?)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Encrypt + send to gateway:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
receipt = sdk.secure_data(document, keys["publicKey"], metadata={"user_id": "U-001"})
|
|
154
|
+
# receipt["id"], receipt["bytesSecured"], etc.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Low-Level API (without class)
|
|
160
|
+
|
|
161
|
+
For simple use cases, you can call the core functions directly without instantiating the class:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from quantacipher import generate_keypair, vault_encrypt, secure_encrypt, secure_decrypt
|
|
165
|
+
|
|
166
|
+
keys = generate_keypair()
|
|
167
|
+
ct = secure_encrypt("Hello, quantum world!", keys["publicKey"])
|
|
168
|
+
pt = secure_decrypt(ct, keys["privateKey"])
|
|
169
|
+
# pt == "Hello, quantum world!"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## API Reference
|
|
175
|
+
|
|
176
|
+
### `QuantaCipher(api_key, gateway_url=None)`
|
|
177
|
+
|
|
178
|
+
### Instance Methods
|
|
179
|
+
|
|
180
|
+
| Method | Description |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `generate_keypair()` | Generate a Kyber-1024 keypair locally → `dict` |
|
|
183
|
+
| `encrypt_vault(plaintext)` | Vault Mode encryption (ephemeral key, no decrypt) → `str` |
|
|
184
|
+
| `encrypt_secure(plaintext, public_key_b64)` | Secure Mode encryption → `str` |
|
|
185
|
+
| `decrypt_secure(ciphertext, private_key_b64)` | Secure Mode local decryption → `str` |
|
|
186
|
+
| `vault_data(plaintext, metadata=None)` | Vault Mode + send to gateway → `dict` (receipt) |
|
|
187
|
+
| `secure_data(plaintext, public_key_b64, metadata=None)` | Secure Mode + send to gateway → `dict` (receipt) |
|
|
188
|
+
| `send_to_gateway(ciphertext, metadata=None)` | Send any ciphertext for a receipt → `dict` |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Payload Format
|
|
193
|
+
|
|
194
|
+
All QuantaCipher ciphertexts are portable string tokens — versionable and cross-runtime compatible:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
QZ_VAULT_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
198
|
+
QZ_SECURE_V1 : <base64 Kyber-1024 CT> : <base64 AES-GCM nonce> : <base64 AES-GCM CT>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
A ciphertext encrypted by the Python SDK can be sent to a JS application or the gateway interchangeably — the format is runtime-agnostic.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT — see [LICENSE](https://github.com/xaexaex/quantacipher/blob/main/LICENSE)
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
<div align="center">
|
|
212
|
+
Built by <a href="https://quantalabs.cc"><strong>QuantaLabs</strong></a> · <a href="https://www.quantacipher.com">quantacipher.com</a>
|
|
213
|
+
</div>
|
quantacipher-0.1.1/PKG-INFO
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# QuantaCipher 🔐
|
|
2
|
-
|
|
3
|
-
Zero-Trust Post-Quantum Cryptography (PQC) SDK for the Enterprise.
|
|
4
|
-
Built on top of the NIST-standardized Kyber algorithm to protect your infrastructure against "Store Now, Decrypt Later" quantum attacks.
|
|
5
|
-
|
|
6
|
-
## Ecosystem
|
|
7
|
-
|
|
8
|
-
- **`quantacipher-core`**: The underlying pure Rust cryptographic implementation.
|
|
9
|
-
- **`quantacipher-sdk`**: The Node.js / TypeScript SDK.
|
|
10
|
-
- **`quantacipher`**: The native Python bindings.
|
|
11
|
-
|
|
12
|
-
## Features
|
|
13
|
-
- **Quantum-Resistant**: Uses FIPS-standardized Kyber key encapsulation.
|
|
14
|
-
- **Zero-Trust**: Keys are generated and retained client-side; only encrypted payloads touch the network.
|
|
15
|
-
- **Cross-Platform**: Compile once in Rust, use flawlessly in JS/TS and Python.
|
|
16
|
-
|
|
17
|
-
## Quickstart
|
|
18
|
-
|
|
19
|
-
### Python
|
|
20
|
-
```bash
|
|
21
|
-
pip install quantacipher
|
|
22
|
-
```
|
|
23
|
-
```python
|
|
24
|
-
import quantacipher
|
|
25
|
-
|
|
26
|
-
keys = quantacipher.generate_keypair()
|
|
27
|
-
ciphertext = quantacipher.secure_encrypt("Top Secret Data", keys["publicKey"])
|
|
28
|
-
plaintext = quantacipher.secure_decrypt(ciphertext, keys["privateKey"])
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### JS/TS (Node.js)
|
|
32
|
-
```bash
|
|
33
|
-
npm install quantacipher-sdk
|
|
34
|
-
```
|
|
35
|
-
```typescript
|
|
36
|
-
import { QuantaCipher } from 'quantacipher-sdk';
|
|
37
|
-
|
|
38
|
-
const sdk = new QuantaCipher({ apiKey: 'your_api_key' });
|
|
39
|
-
const keys = sdk.generateKeypair();
|
|
40
|
-
const ciphertext = sdk.encryptSecure("Top Secret Data", keys.publicKey);
|
|
41
|
-
const plaintext = sdk.decryptSecure(ciphertext, keys.privateKey);
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Commercial & Enterprise Use
|
|
45
|
-
QuantaCipher SDKs are open-source and free to use. To manage API keys, audit logs, and scale your cryptography, check out our [Enterprise SaaS Platform](https://quantacipher.com).
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# QuantaCipher
|
|
2
|
-
|
|
3
|
-
Zero-Trust Post-Quantum Cryptography library for Python.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pip install quantacipher
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Commercial & Enterprise Use
|
|
12
|
-
To manage API keys, audit logs, and scale your cryptography, check out our Enterprise SaaS Platform at https://quantacipher.com.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|