[seal] Sealed boxes and key import: custos-seal (X25519 + XChaCha20-Poly1305, match code, at-rest sealing), custos_keys::import, Vault::factor_ids; v0.5.0
This commit is contained in:
@@ -36,3 +36,26 @@ Each gives:
|
||||
- `fingerprint`: `SHA256:…`, exactly as `ssh-keygen -l` prints it.
|
||||
|
||||
The crates are RustCrypto's: `ssh-key`, `ed25519-dalek` (its Ed25519 backend), `p256`, `rsa`.
|
||||
|
||||
## Importing (`custos_keys::import`)
|
||||
|
||||
An existing private key becomes the same kind of item. Accepted formats:
|
||||
|
||||
| Input | Header | Algorithms |
|
||||
|:--|:--|:--|
|
||||
| OpenSSH private key | `BEGIN OPENSSH PRIVATE KEY` | Ed25519, ECDSA P-256, RSA |
|
||||
| PKCS#8 | `BEGIN PRIVATE KEY` | Ed25519, ECDSA P-256, RSA |
|
||||
| PKCS#1 | `BEGIN RSA PRIVATE KEY` | RSA |
|
||||
| SEC1 | `BEGIN EC PRIVATE KEY` | ECDSA P-256 |
|
||||
|
||||
- **The public line, the PEMs and the fingerprint are derived from the private key**, never copied from the
|
||||
input. A pasted public key therefore cannot disagree with its private key.
|
||||
- **RSA:** 2048 to 4096 bits. An imported 2048-bit key is named `rsa-2048`; Custos never generates one.
|
||||
- **A passphrase-protected key is refused** (`Encrypted`): OpenSSH with a cipher, `ENCRYPTED PRIVATE KEY`,
|
||||
or PKCS#1 with `Proc-Type: 4,ENCRYPTED`. Remove the passphrase first (`ssh-keygen -p`); the vault is the
|
||||
key's encryption.
|
||||
- **Comment:** an OpenSSH key keeps its own comment; the other formats take the item's name.
|
||||
- **Line ends:** CRLF and surrounding whitespace are accepted, as in a paste or a Windows file.
|
||||
- **Errors never repeat the input.**
|
||||
- **ssh-key 0.6.7 conversion bug:** its `TryFrom<&RsaKeypair> for rsa::RsaPrivateKey` uses `p` twice. Custos
|
||||
rebuilds the key from `n, e, d, p, q` and validates it instead.
|
||||
|
||||
Reference in New Issue
Block a user