Documentation
¶
Overview ¶
Package sealedbox implements the Kryptic P-256 ECDH sealed box: encrypt a value to a recipient's public key so only the holder of the matching private key can open it. This is the asymmetric layer the blind store uses to deliver the org key; the wire format and derivation are locked by interop-vectors/sealed-box-p256.json (canonical copies live in all three encryption repositories).
Construction (ECIES): fresh ephemeral P-256 key pair per message, ECDH against the recipient public key, HKDF-SHA256 expanded to a 32-byte AES key and a 12-byte nonce (derived, not random: the per-message key makes it safe and the seal reproducible), then AES-256-GCM. No custom primitives.
Index ¶
Constants ¶
const ( // FormatVersion is the sealed-box wire format version this package produces. FormatVersion = 1 // PublicKeySize is the uncompressed SEC1 P-256 point: 0x04 || X(32) || Y(32). PublicKeySize = 65 // PrivateKeySize is the P-256 scalar, big-endian. PrivateKeySize = 32 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyPair ¶
type KeyPair struct {
Public []byte // 65-byte uncompressed SEC1 point
Private []byte // 32-byte big-endian scalar
}
KeyPair is a P-256 key pair in the portable encodings shared with the C# and WebCrypto implementations.
func GenerateKeyPair ¶
GenerateKeyPair creates a fresh P-256 key pair.