Documentation
¶
Overview ¶
Package crypto provides authenticated symmetric encryption (AES-256-GCM) for secrets stored at rest, such as registry credentials. The key is generated once and persisted alongside the other server secrets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher seals and opens short secrets with AES-GCM. The nonce is random per message and prepended to the ciphertext; output is base64 for DB storage.
func (*Cipher) Decrypt ¶
Decrypt reverses Encrypt. A wrong key or tampered ciphertext yields an error.
func (*Cipher) Fingerprint ¶ added in v1.7.0
Fingerprint returns a deterministic, keyed digest of plain: the same value always yields the same fingerprint, a different value yields a different one, and the digest cannot be reversed to recover plain. It must stay a keyed HMAC, never a bare sha256(plain) — an unkeyed hash would let an attacker precompute digests of common/weak values and match them against a fingerprint shown in a UI, defeating the point of masking. The HMAC key is a subkey HKDF-derived from the AES key (see New), never the raw AES key itself, so the two primitives never share key material.