Documentation ¶
Index ¶
- Constants
- func DecryptAuth(params *Params, skR crypto.PrivateKey, pkI crypto.PublicKey, ...) (pt []byte, err error)
- func DecryptBase(params *Params, skR crypto.PrivateKey, enc, ct, aad []byte) (pt []byte, err error)
- func DecryptPSK(params *Params, skR crypto.PrivateKey, enc, ct, aad, psk, pskID []byte) (pt []byte, err error)
- func EncryptAuth(params *Params, random io.Reader, pkR crypto.PublicKey, skI crypto.PrivateKey, ...) (ct, enc []byte, err error)
- func EncryptBase(params *Params, random io.Reader, pkR crypto.PublicKey, pt, aad []byte) (ct, enc []byte, err error)
- func EncryptPSK(params *Params, random io.Reader, pkR crypto.PublicKey, ...) (ct, enc []byte, err error)
- func GenerateKeyPair(params *Params, random io.Reader) (private crypto.PrivateKey, public crypto.PublicKey, err error)
- func Marshall(params *Params, key interface{}) (keyBytes []byte, err error)
- func MarshallPrivate(params *Params, key interface{}) (keyBytes []byte, err error)
- func Unmarshall(params *Params, keyBytes []byte) (pub crypto.PublicKey, err error)
- func UnmarshallPrivate(params *Params, keyBytes []byte) (prv crypto.PrivateKey, err error)
- type Params
Constants ¶
const ( BASE_P256_SHA256_AES_GCM_128 byte = iota BASE_P256_SHA256_ChaCha20Poly1305 PSK_P256_SHA256_AES_GCM_128 PSK_P256_SHA256_ChaCha20Poly1305 AUTH_P256_SHA256_AES_GCM_128 AUTH_P256_SHA256_ChaCha20Poly1305 BASE_X25519_SHA256_AES_GCM_128 BASE_X25519_SHA256_ChaCha20Poly1305 PSK_X25519_SHA256_AES_GCM_128 PSK_X25519_SHA256_ChaCha20Poly1305 AUTH_X25519_SHA256_AES_GCM_128 AUTH_X25519_SHA256_ChaCha20Poly1305 BASE_P521_SHA512_AES_GCM_256 BASE_P521_SHA512_ChaCha20Poly1305 PSK_P521_SHA512_AES_GCM_256 PSK_P521_SHA512_ChaCha20Poly1305 AUTH_P521_SHA512_AES_GCM_256 AUTH_P521_SHA512_ChaCha20Poly1305 BASE_P256_SHA256_XChaCha20Blake2bSIV PSK_P256_SHA256_XChaCha20Blake2bSIV AUTH_P256_SHA256_XChaCha20Blake2bSIV BASE_X25519_SHA256_XChaCha20Blake2bSIV PSK_X25519_SHA256_XChaCha20Blake2bSIV AUTH_X25519_SHA256_XChaCha20Blake2bSIV BASE_P521_SHA256_XChaCha20Blake2bSIV PSK_P521_SHA256_XChaCha20Blake2bSIV AUTH_P521_SHA256_XChaCha20Blake2bSIV )
Variables ¶
This section is empty.
Functions ¶
func DecryptAuth ¶
func DecryptAuth(params *Params, skR crypto.PrivateKey, pkI crypto.PublicKey, enc, ct, aad []byte) (pt []byte, err error)
DecryptAuth is a function for decryption in the asymmetric key mode
func DecryptBase ¶
DecryptBase is a function for decryption in the base mode
func DecryptPSK ¶
func DecryptPSK(params *Params, skR crypto.PrivateKey, enc, ct, aad, psk, pskID []byte) (pt []byte, err error)
DecryptPSK is a function for decryption in the pre-shared key mode
func EncryptAuth ¶
func EncryptAuth(params *Params, random io.Reader, pkR crypto.PublicKey, skI crypto.PrivateKey, pt, aad []byte) (ct, enc []byte, err error)
EncryptAuth is a function for encryption in the asymmetric key mode Optional arguments:
`random` is optional. If `nil` crypto/rand.Reader is used `aad` and `info` are optional.
func EncryptBase ¶
func EncryptBase(params *Params, random io.Reader, pkR crypto.PublicKey, pt, aad []byte) (ct, enc []byte, err error)
EncryptBase is a function for encryption in the base mode Optional arguments:
`random` is optional. If `nil` crypto/rand.Reader is used `aad` and `info` are optional.
func EncryptPSK ¶
func EncryptPSK(params *Params, random io.Reader, pkR crypto.PublicKey, pt, aad, psk, pskID []byte) (ct, enc []byte, err error)
EncryptPSK is a function for encryption in the pre-shared key mode Optional arguments:
`random` is optional. If `nil` crypto/rand.Reader is used `aad` and `info` are optional.
func GenerateKeyPair ¶
func GenerateKeyPair(params *Params, random io.Reader) (private crypto.PrivateKey, public crypto.PublicKey, err error)
GenerateKeyPair generates a key pair for a given parameter set. Argument `random` is optional. If `nil` crypto/rand.Reader is used
func Marshall ¶
Marshall produces a fixed-length octet string encoding the public key "pk" checks whether a generic interface matches the right type of a HPKE public key performs casting from crypto.PublicKey to ecdh.Point (when using public key of generic curves) or byte array Reference 1: https://github.com/aead/ecdh/blob/master/generic.go#L99-L121 Reference 2: https://github.com/aead/ecdh/blob/master/curve25519.go#L88-L108
func MarshallPrivate ¶
MarshallPrivate a fixed-length octet string encoding the private key
func Unmarshall ¶
Unmarshall parses a fixed-length octet string to recover a public key restores the public key from byte array after marshall
func UnmarshallPrivate ¶
func UnmarshallPrivate(params *Params, keyBytes []byte) (prv crypto.PrivateKey, err error)
UnmarshallPrivate parses a fixed-length octet string to recover a private key restores the private key from byte array after marshall