Documentation
¶
Overview ¶
Package hpke implements Hybrid Public Key Encryption (HPKE).
See RFC 9180.
Index ¶
- Constants
- func GenerateKeyPairX25519() (publicKey, secretKeyOut []byte, err error)
- func GetHKDFHash(kdf uint16) (crypto.Hash, error)
- type Context
- func SetupBaseReceiverX25519(kdfID, aeadID uint16, enc, secretKeyR, info []byte) (context *Context, err error)
- func SetupBaseSenderX25519(kdfID, aeadID uint16, publicKeyR, info []byte, ephemKeygen GenerateKeyPairFunc) (context *Context, enc []byte, err error)
- func SetupPSKReceiverX25519(kdfID, aeadID uint16, enc, secretKeyR, info, psk, pskID []byte) (context *Context, err error)
- func SetupPSKSenderX25519(kdfID, aeadID uint16, publicKeyR, info, psk, pskID []byte, ...) (context *Context, enc []byte, err error)
- func (c *Context) AEAD() uint16
- func (c *Context) Export(exporterContext []byte, length int) []byte
- func (c *Context) KDF() uint16
- func (c *Context) KEM() uint16
- func (c *Context) Open(ciphertext, additionalData []byte) ([]byte, error)
- func (c *Context) Overhead() int
- func (c *Context) Seal(plaintext, additionalData []byte) []byte
- type GenerateKeyPairFunc
Constants ¶
View Source
const ( P256WithHKDFSHA256 uint16 = 0x0010 X25519WithHKDFSHA256 uint16 = 0x0020 )
KEM scheme IDs.
View Source
const ( AES128GCM uint16 = 0x0001 AES256GCM uint16 = 0x0002 ChaCha20Poly1305 uint16 = 0x0003 )
HPKE AEAD IDs.
View Source
const ( HKDFSHA256 uint16 = 0x0001 HKDFSHA384 uint16 = 0x0002 HKDFSHA512 uint16 = 0x0003 )
HPKE KDF IDs.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPairX25519 ¶
GenerateKeyPairX25519 generates a random X25519 key pair.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context holds the HPKE state for a sender or a receiver.
func SetupBaseReceiverX25519 ¶
func SetupBaseReceiverX25519(kdfID, aeadID uint16, enc, secretKeyR, info []byte) (context *Context, err error)
SetupBaseReceiverX25519 corresponds to the spec's SetupBaseR(), but only supports X25519.
func SetupBaseSenderX25519 ¶
func SetupBaseSenderX25519(kdfID, aeadID uint16, publicKeyR, info []byte, ephemKeygen GenerateKeyPairFunc) (context *Context, enc []byte, err error)
SetupBaseSenderX25519 corresponds to the spec's SetupBaseS(), but only supports X25519.
func SetupPSKReceiverX25519 ¶
func SetupPSKReceiverX25519(kdfID, aeadID uint16, enc, secretKeyR, info, psk, pskID []byte) (context *Context, err error)
SetupPSKReceiverX25519 corresponds to the spec's SetupPSKR(), but only supports X25519.
func SetupPSKSenderX25519 ¶
func SetupPSKSenderX25519(kdfID, aeadID uint16, publicKeyR, info, psk, pskID []byte, ephemKeygen GenerateKeyPairFunc) (context *Context, enc []byte, err error)
SetupPSKSenderX25519 corresponds to the spec's SetupPSKS(), but only supports X25519.
type GenerateKeyPairFunc ¶
Click to show internal directories.
Click to hide internal directories.