Documentation ¶
Overview ¶
Package adapter provides an adhoc hashed ElGamal construction that essentially acts like an adapter, adapting a NIKE to KEM.
Index ¶
- Constants
- func FromNIKE(nike nike.Scheme) kem.Scheme
- type PrivateKey
- type PublicKey
- type Scheme
- func (a *Scheme) CiphertextSize() int
- func (a *Scheme) Decapsulate(myPrivkey kem.PrivateKey, ct []byte) ([]byte, error)
- func (a *Scheme) DeriveKeyPair(seed []byte) (kem.PublicKey, kem.PrivateKey)
- func (a *Scheme) Encapsulate(pk kem.PublicKey) (ct, ss []byte, err error)
- func (a *Scheme) EncapsulateDeterministically(pk kem.PublicKey, seed []byte) (ct, ss []byte, err error)
- func (a *Scheme) GenerateKeyPair() (kem.PublicKey, kem.PrivateKey, error)
- func (a *Scheme) Name() string
- func (a *Scheme) PrivateKeySize() int
- func (a *Scheme) PublicKeySize() int
- func (a *Scheme) SeedSize() int
- func (a *Scheme) SharedKeySize() int
- func (a *Scheme) UnmarshalBinaryPrivateKey(b []byte) (kem.PrivateKey, error)
- func (a *Scheme) UnmarshalBinaryPublicKey(b []byte) (kem.PublicKey, error)
- func (a *Scheme) UnmarshalTextPrivateKey(text []byte) (kem.PrivateKey, error)
- func (a *Scheme) UnmarshalTextPublicKey(text []byte) (kem.PublicKey, error)
Constants ¶
const (
// SeedSize is the number of bytes needed to seed deterministic methods below.
SeedSize = 32
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is an adapter for nike.PrivateKey to kem.PrivateKey.
func (*PrivateKey) Equal ¶
func (p *PrivateKey) Equal(privkey kem.PrivateKey) bool
func (*PrivateKey) MarshalBinary ¶
func (p *PrivateKey) MarshalBinary() ([]byte, error)
func (*PrivateKey) Public ¶
func (p *PrivateKey) Public() kem.PublicKey
func (*PrivateKey) Scheme ¶
func (p *PrivateKey) Scheme() kem.Scheme
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is an adapter for nike.PublicKey to kem.PublicKey.
func (*PublicKey) MarshalBinary ¶
func (*PublicKey) MarshalText ¶ added in v0.0.3
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
Scheme is an adapter for nike.Scheme to kem.Scheme. See docs/specs/kemsphinx.rst for some design notes on this NIKE to KEM adapter.
func (*Scheme) Decapsulate ¶
Returns the shared key encapsulated in ciphertext ct for the private key sk. Implements DECAPSULATE as described in NIKE to KEM adapter, see docs/specs/kemsphinx.rst
func (*Scheme) DeriveKeyPair ¶
DeriveKeyPair deterministically derives a pair of keys from a seed. Panics if the length of seed is not equal to the value returned by SeedSize.
func (*Scheme) Encapsulate ¶
Encapsulate generates a shared key ss for the public key and encapsulates it into a ciphertext ct.
func (*Scheme) EncapsulateDeterministically ¶
func (a *Scheme) EncapsulateDeterministically(pk kem.PublicKey, seed []byte) ( ct, ss []byte, err error)
EncapsulateDeterministically generates a shared key ss for the public key deterministically from the given seed and encapsulates it into a ciphertext ct. If unsure, you're better off using Encapsulate(). Implements ENCAPSULATE as described in NIKE to KEM adapter, see docs/specs/kemsphinx.rst
func (*Scheme) GenerateKeyPair ¶
GenerateKeyPair creates a new key pair.
func (*Scheme) SharedKeySize ¶
Size of established shared keys.
func (*Scheme) UnmarshalBinaryPrivateKey ¶
func (a *Scheme) UnmarshalBinaryPrivateKey(b []byte) (kem.PrivateKey, error)
Unmarshals a PrivateKey from the provided buffer.
func (*Scheme) UnmarshalBinaryPublicKey ¶
Unmarshals a PublicKey from the provided buffer.
func (*Scheme) UnmarshalTextPrivateKey ¶ added in v0.0.4
func (a *Scheme) UnmarshalTextPrivateKey(text []byte) (kem.PrivateKey, error)