Package hpke
- Constants
- Variables
- func ParseHPKEPrivateKey(kemID uint16, bytes []byte) (*ecdh.PrivateKey, error)
- func ParseHPKEPublicKey(kemID uint16, bytes []byte) (*ecdh.PublicKey, error)
- type AEADID
- type KDFID
- type KemID
- type Receipient
- func SetupReceipient(kemID, kdfID, aeadID uint16, priv *ecdh.PrivateKey, info, encPubEph []byte) (*Receipient, error)
- func (r *Receipient) Open(aad, ciphertext []byte) ([]byte, error)
- type Sender
- func SetupSender(kemID, kdfID, aeadID uint16, pub *ecdh.PublicKey, info []byte) ([]byte, *Sender, error)
- func (s *Sender) Seal(aad, plaintext []byte) ([]byte, error)
Package files
hpke.go
Constants
const (
AEAD_AES_128_GCM = 0x0001
AEAD_AES_256_GCM = 0x0002
AEAD_ChaCha20Poly1305 = 0x0003
)
const DHKEM_X25519_HKDF_SHA256 = 0x0020
const KDF_HKDF_SHA256 = 0x0001
Variables
var SupportedAEADs = map[uint16]struct {
keySize int
nonceSize int
aead func([]byte) (cipher.AEAD, error)
}{
AEAD_AES_128_GCM: {},
AEAD_AES_256_GCM: {},
AEAD_ChaCha20Poly1305: {},
}
var SupportedKDFs = map[uint16]func() *hkdfKDF{
KDF_HKDF_SHA256: func() *hkdfKDF { return &hkdfKDF{crypto.SHA256} },
}
var SupportedKEMs = map[uint16]struct {
curve ecdh.Curve
hash crypto.Hash
nSecret uint16
}{
DHKEM_X25519_HKDF_SHA256: {ecdh.X25519(), crypto.SHA256, 32},
}
func ParseHPKEPrivateKey(kemID uint16, bytes []byte) (*ecdh.PrivateKey, error)
func ParseHPKEPublicKey(kemID uint16, bytes []byte) (*ecdh.PublicKey, error)
type AEADID uint16
type KDFID uint16
type KemID uint16
type Receipient struct {
}
func SetupReceipient(kemID, kdfID, aeadID uint16, priv *ecdh.PrivateKey, info, encPubEph []byte) (*Receipient, error)
func (*Receipient) Open
¶
func (r *Receipient) Open(aad, ciphertext []byte) ([]byte, error)
type Sender struct {
}
func SetupSender(kemID, kdfID, aeadID uint16, pub *ecdh.PublicKey, info []byte) ([]byte, *Sender, error)
func (*Sender) Seal
¶
func (s *Sender) Seal(aad, plaintext []byte) ([]byte, error)