Documentation ¶
Overview ¶
Package combiner defines a security preserving KEM combiner. The [KEM Combiners paper](https://eprint.iacr.org/2018/024.pdf) makes the observation that if a KEM combiner is not security preserving then the resulting hybrid KEM will not have IND-CCA2 security if one of the composing KEMs does not have IND-CCA2 security. Likewise the paper points out that when using a security preserving KEM combiner, if only one of the composing KEMs has IND-CCA2 security then the resulting hybrid KEM will have IND-CCA2 security.
Our KEM combiner uses the split PRF design for an arbitrary number of kems, here shown with only three, in pseudo code:
```
func SplitPRF(ss1, ss2, ss3, cct1, cct2, cct3 []byte) []byte { cct := cct1 || cct2 || cct3 return PRF(ss1 || cct) XOR PRF(ss2 || cct) XOR PRF(ss3 || cct) }
```
Index ¶
- Variables
- type PrivateKey
- type PublicKey
- type Scheme
- func (sch *Scheme) CiphertextSize() int
- func (sch *Scheme) Decapsulate(sk kem.PrivateKey, ct []byte) ([]byte, error)
- func (sch *Scheme) DeriveKeyPair(seed []byte) (kem.PublicKey, kem.PrivateKey)
- func (sch *Scheme) Encapsulate(pk kem.PublicKey) (ct, ss []byte, err error)
- func (sch *Scheme) EncapsulateDeterministically(publicKey kem.PublicKey, seed []byte) (ct, ss []byte, err error)
- func (sch *Scheme) GenerateKeyPair() (kem.PublicKey, kem.PrivateKey, error)
- func (sch *Scheme) Name() string
- func (sch *Scheme) PrivateKeySize() int
- func (sch *Scheme) PublicKeySize() int
- func (sch *Scheme) SeedSize() int
- func (sch *Scheme) SharedKeySize() int
- func (sch *Scheme) UnmarshalBinaryPrivateKey(buf []byte) (kem.PrivateKey, error)
- func (sch *Scheme) UnmarshalBinaryPublicKey(buf []byte) (kem.PublicKey, error)
- func (sch *Scheme) UnmarshalTextPrivateKey(text []byte) (kem.PrivateKey, error)
- func (sch *Scheme) UnmarshalTextPublicKey(text []byte) (kem.PublicKey, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUninitialized indicates a key wasn't initialized. ErrUninitialized = errors.New("public or private key not initialized") )
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
Private key of a hybrid KEM.
func (*PrivateKey) Equal ¶
func (sk *PrivateKey) Equal(other kem.PrivateKey) bool
Equal performs a non-constant time key comparison.
func (*PrivateKey) MarshalBinary ¶
func (sk *PrivateKey) MarshalBinary() ([]byte, error)
MarshalBinary creates a binary blob of the key.
func (*PrivateKey) Public ¶
func (sk *PrivateKey) Public() kem.PublicKey
Public returns a public key, given a private key.
func (*PrivateKey) Scheme ¶
func (sk *PrivateKey) Scheme() kem.Scheme
Scheme returns the given private key's scheme object.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
Public key of a combined KEMs.
func (*PublicKey) MarshalBinary ¶
MarshalBinary returns a binary blob of the key.
func (*PublicKey) MarshalText ¶ added in v0.0.3
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
Scheme for a hybrid KEM.
func (*Scheme) CiphertextSize ¶
CiphertextSize returns the KEM's ciphertext size in bytes.
func (*Scheme) Decapsulate ¶
Decapsulate decrypts a given KEM ciphertext using the given private key.
func (*Scheme) DeriveKeyPair ¶
DeriveKeyPair uses a seed value to deterministically generate a key pair.
func (*Scheme) Encapsulate ¶
Encapsulate creates a shared secret and ciphertext given a public key.
func (*Scheme) EncapsulateDeterministically ¶
func (sch *Scheme) EncapsulateDeterministically(publicKey kem.PublicKey, seed []byte) (ct, ss []byte, err error)
EncapsulateDeterministically deterministircally encapsulates a share secret to the given public key and the given seed value.
func (*Scheme) GenerateKeyPair ¶
GenerateKeyPair generates a keypair.
func (*Scheme) PrivateKeySize ¶
PrivateKeySize returns the KEM's private key size in bytes.
func (*Scheme) PublicKeySize ¶
PublicKeySize returns the KEM's public key size in bytes.
func (*Scheme) SharedKeySize ¶
SharedKeySize returns the KEM's shared key size in bytes.
func (*Scheme) UnmarshalBinaryPrivateKey ¶
func (sch *Scheme) UnmarshalBinaryPrivateKey(buf []byte) (kem.PrivateKey, error)
UnmarshalBinaryPrivateKey unmarshals a binary blob representing a private key.
func (*Scheme) UnmarshalBinaryPublicKey ¶
UnmarshalBinaryPublicKey unmarshals a binary blob representing a public key.
func (*Scheme) UnmarshalTextPrivateKey ¶ added in v0.0.4
func (sch *Scheme) UnmarshalTextPrivateKey(text []byte) (kem.PrivateKey, error)