1.8 KiB
1.8 KiB
Keys, API keys and key pairs
What custos-gen and custos-keys generate besides passwords. All randomness comes from the OS CSPRNG.
Secret keys (custos_gen::secret_key)
16 ..= 128 random bytes (default 32 = 256 bits), written as lowercase hex, base64url without padding, or standard base64 with padding. For symmetric keys, HMAC and JWT secrets, encryption passphrases for tools.
API keys (custos_gen::api_key)
<prefix>_<32 base62 characters><6 base62 characters of checksum> e.g. domi_7Kq…Zx41aP0c
prefix: empty, or a lowercase letter then up to 15 lowercase letters or digits. It says what the key is for at a glance, and lets leak scanners find it. No prefix: the key starts with the 32 characters.- 32 base62 characters: 190.5 bits, each character uniform (rejection sampling, no modulo bias).
- The checksum is CRC-32 (IEEE) of everything before it, in base62, padded to 6 characters. It catches typos and lets a scanner tell a real key from random text. It is not a security feature.
Key pairs (custos_keys::generate)
| Algorithm | Name in the item | Notes |
|---|---|---|
| Ed25519 | ed25519 |
the default: SSH, signing, minisign-style tools |
| ECDSA P-256 | ecdsa-p256 |
where Ed25519 is not accepted (some cloud KMS, older hardware) |
| RSA 3072 / 4096 | rsa-3072, rsa-4096 |
for systems that accept nothing else; generation takes seconds |
Each gives:
public-key: the OpenSSH public line (ssh-ed25519 AAAA… comment), forauthorized_keys;public-pem: the SubjectPublicKeyInfo PEM;private-key*: the PKCS#8 PEM (unencrypted; the vault is its encryption);private-openssh*: the OpenSSH private key (unencrypted, same reason), forssh -i;fingerprint:SHA256:…, exactly asssh-keygen -lprints it.
The crates are RustCrypto's: ssh-key, ed25519-dalek (its Ed25519 backend), p256, rsa.