[seal] Recipient: a kept key (from_secret refuses a known key, secret_bytes for DPAPI storage), Debug redacted; docs/SEAL.md
This commit is contained in:
+23
-2
@@ -20,8 +20,29 @@ aad "CSL1" ‖ E ‖ context
|
||||
A box opens only with the context it was sealed for, so a box for one request does not work as another.
|
||||
- **A low-order public key is refused** on both sides: the shared secret must be contributory.
|
||||
- **Plaintext limit:** 32 KiB.
|
||||
- **The recipient's secret half** lives only in memory, as `x25519_dalek::StaticSecret` with `zeroize`,
|
||||
and is wiped on drop. Nothing writes it to disk.
|
||||
- **The recipient's secret half** lives in memory as `x25519_dalek::StaticSecret` with `zeroize`, and is
|
||||
wiped on drop. One-time keys (`Recipient::generate`) are the default and nothing writes them to disk.
|
||||
|
||||
### A kept key (core 0.11.0)
|
||||
|
||||
The recipient's secret may now be kept by the caller, for one purpose: the PC's Provisio sealing key
|
||||
(docs/10_provisio.md in the app), the key the server seals **offers** to. Custos makes it once with
|
||||
`Recipient::generate`, keeps `Recipient::secret_bytes()` DPAPI-sealed in `<data>actors\provision.key`, and
|
||||
restores it with `Recipient::from_secret` at every start. Everything else (approvals, pairing, a Provisio *ask*)
|
||||
still uses a fresh one-time key per request.
|
||||
|
||||
```
|
||||
Recipient::from_secret(Zeroizing<[u8; 32]>) -> Result<Recipient, SealError> // BadKey for a known key
|
||||
Recipient::secret_bytes(&self) -> Zeroizing<[u8; 32]> // only for a key that is kept
|
||||
```
|
||||
|
||||
- `from_secret` refuses (`BadKey`) a secret that X25519 clamps to zero (all zeros: a wiped or never-filled
|
||||
buffer) and, as for public keys, one whose shared secrets would not be contributory.
|
||||
- A kept key opens every box ever sealed to it, so the **context** carries the binding: an offer is sealed for
|
||||
`provision-offer:<store>:<item>`, and the PC checks the plaintext's item, store, kind and code key against the
|
||||
offer before it shows a card. The mailbox refuses an offer whose ephemeral key it has seen (replay).
|
||||
- `secret_bytes` hands out the secret in a `Zeroizing` buffer. It goes to the caller's sealed storage and
|
||||
nowhere else: never a log, a message or a file in the clear. `Debug` of a `Recipient` prints `[redacted]`.
|
||||
|
||||
## The match code
|
||||
|
||||
|
||||
Reference in New Issue
Block a user