Documentation
¶
Overview ¶
Package keymaterial hosts the file-or-value key loading and DER parsing mechanism shared by the keystore module and the cmd/seal-payload CLI. keystore wraps these calls with its "keystore: key %q ..." error prefixes; cmd/seal-payload consumes them directly, so the CLI can never accept a key format the middleware's keystore would reject.
Index ¶
- func LoadBytes(file, value string) ([]byte, error)
- func LoadPassword(env, file string) (string, error)
- func LoadSecretBytes(file, value string) ([]byte, error)
- func ParsePKCS12RSA(pfx []byte, password string) (*rsa.PrivateKey, error)
- func ParseRSAPrivateKey(der []byte) (*rsa.PrivateKey, error)
- func ParseRSAPublicKey(der []byte) (*rsa.PublicKey, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadBytes ¶
LoadBytes resolves file-or-value key material to raw bytes (DER for RSA). When both are set, file wins (keystore's historical behavior — callers wanting exactly-one-of must enforce it themselves). Returns (nil, nil) when neither is set.
func LoadPassword ¶ added in v0.62.0
LoadPassword resolves a PKCS#12 password from the named environment variable or from a file (trailing newlines stripped). No error echoes the variable name, the path, or the value.
func LoadSecretBytes ¶
LoadSecretBytes is LoadBytes for raw symmetric secrets. Secret material has no detectable shape (no PEM/DER structure), so a mis-filed value cannot be caught by LooksLikeKeyMaterial — instead, NO error on this path ever echoes the configured file value or the underlying path. SECURITY: a transposed secret.file/secret.value must not put key material into a fatal startup log line; strip the path from wrapped OS errors.
func ParsePKCS12RSA ¶ added in v0.62.0
func ParsePKCS12RSA(pfx []byte, password string) (*rsa.PrivateKey, error)
ParsePKCS12RSA decodes a password-protected PKCS#12 bundle into its RSA private key. The leaf certificate must carry the matching RSA public key; any CA chain in the bundle is discarded.
func ParseRSAPrivateKey ¶
func ParseRSAPrivateKey(der []byte) (*rsa.PrivateKey, error)
ParseRSAPrivateKey parses PKCS#8 DER (PKCS#1 fallback) into an *rsa.PrivateKey.
Types ¶
This section is empty.