package crypto import "io" // KEM defines the contract for a Key Encapsulation Mechanism. type KEM interface { SchemeID() uint16 GenerateKeyPair( rand io.Reader, ) ( RecipientPub, RecipientPriv, error, ) Encapsulate( pub RecipientPub, rand io.Reader, ) ( ciphertext []byte, sharedSecret []byte, err error, ) Decapsulate( priv RecipientPriv, ciphertext []byte, ) ( sharedSecret []byte, err error, ) LoadPriv( raw []byte, ) ( RecipientPriv, error, ) } // RecipientPub represents a public recipient key. type RecipientPub interface { SchemeID() uint16 KeyID() []byte Raw() []byte } // RecipientPriv represents a private recipient key. type RecipientPriv interface { SchemeID() uint16 KeyID() []byte Raw() []byte }