Documentation
¶
Index ¶
- Constants
- func AppendPublic[Public any](out []byte, s PublicKeyScheme[Public], pub *Public) []byte
- func TestScheme256[Priv, Pub any](t *testing.T, scheme Scheme256[Priv, Pub])
- type Dual256
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) CiphertextSize() int
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) Decapsulate(ss *Secret256, priv *DualKey[LPriv, RPriv], ct []byte) error
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) DerivePublic(x *DualKey[LPriv, RPriv]) DualKey[LPub, RPub]
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) Encapsulate(ss *Secret256, ct []byte, pub *DualKey[LPub, RPub], seed *Seed) error
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) Generate(rng io.Reader) (DualKey[LPub, RPub], DualKey[LPriv, RPriv], error)
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) MarshalPrivate(dst []byte, x *DualKey[LPriv, RPriv])
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) MarshalPublic(dst []byte, x *DualKey[LPub, RPub])
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) ParsePrivate(x []byte) (DualKey[LPriv, RPriv], error)
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) ParsePublic(x []byte) (DualKey[LPub, RPub], error)
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) PrivateKeySize() int
- func (s Dual256[LPriv, LPub, RPriv, RPub, XOF]) PublicKeySize() int
- type DualKey
- type PrivateKeyScheme
- type PublicKeyScheme
- type Scheme256
- type Secret256
- type Seed
Constants ¶
View Source
const SeedSize = 32
SeedSize is the size of Seed in bytes
Variables ¶
This section is empty.
Functions ¶
func AppendPublic ¶
func AppendPublic[Public any](out []byte, s PublicKeyScheme[Public], pub *Public) []byte
Types ¶
type Dual256 ¶
type Dual256[LPriv, LPub, RPriv, RPub, XOF any] struct { L Scheme256[LPriv, LPub] R Scheme256[RPriv, RPub] XOF xof.Scheme[XOF] }
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) CiphertextSize ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) Decapsulate ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) DerivePublic ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) Encapsulate ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) MarshalPrivate ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) MarshalPublic ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) ParsePrivate ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) ParsePublic ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) PrivateKeySize ¶
func (Dual256[LPriv, LPub, RPriv, RPub, XOF]) PublicKeySize ¶
type PrivateKeyScheme ¶
type PrivateKeyScheme[Private any] interface { // MarshalPrivate marshals pub and writes the bytes to dst. // If len(dst) < PrivateKeySize() then MarshalPrivate panics MarshalPrivate(dst []byte, pub *Private) // ParsePrivate attempts to parse a private key from the input, and returns a private key or error. ParsePrivate([]byte) (Private, error) // PrivateKeySize returns the size of a marshalled private key PrivateKeySize() int }
type PublicKeyScheme ¶
type PublicKeyScheme[Public any] interface { // MarshalPublic marshals pub and writes the bytes to dst. // If len(dst) < PublicKeySize() then MarshalPublic panics MarshalPublic(dst []byte, pub *Public) // ParsePublic attempts to parse a public key from the input, and returns a public key or error. ParsePublic([]byte) (Public, error) // PublicKeySize returns the size of the public key PublicKeySize() int }
type Scheme256 ¶
type Scheme256[Private, Public any] interface { // Generate creates a new private/public key pair using entropy from rng. Generate(rng io.Reader) (Public, Private, error) // DerivePublic returns the public key corresponding to the private key DerivePublic(*Private) Public // Encapsulate writes a shared secret to ss, and a ciphertext to ct. // The ciphertext will decryptable by pub. // // The shared secret written to ss will be uniformly random. // If ct is not >= CiphertextSize(), then Encapsulate will panic Encapsulate(ss *Secret256, ct []byte, pub *Public, seed *Seed) error // Decapsulate uses priv to decrypt a ciphertext from ct, and writes the resulting shared secret to ss. // The shared secret written to ss will be uniformly random. // If ct is not == CiphertextSize(), then Encapsulate should return an error. Decapsulate(ss *Secret256, priv *Private, ct []byte) error PublicKeyScheme[Public] PrivateKeyScheme[Private] CiphertextSize() int }
Scheme256 is a Key Encapsulation Mechanism which agrees on a shared 256 bit secret key
Click to show internal directories.
Click to hide internal directories.