xwing

package
v0.0.0-...-2eaef2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package xwing implements the hybrid quantum-resistant key encapsulation method X-Wing, which combines X25519, ML-KEM-768, and SHA3-256 as specified in draft-connolly-cfrg-xwing-kem-01.

Future v0 versions of this package might introduce backwards incompatible changes to implement changes to draft-connolly-cfrg-xwing-kem or FIPS 203.

Index

Constants

View Source
const (
	CiphertextSize       = mlkem768.CiphertextSize + 32
	EncapsulationKeySize = mlkem768.EncapsulationKeySize + 32
	DecapsulationKeySize = mlkem768.DecapsulationKeySize + 32 + 32
	SharedKeySize        = 32
	SeedSize             = mlkem768.SeedSize + 32
)

Variables

This section is empty.

Functions

func Decapsulate

func Decapsulate(decapsulationKey, ciphertext []byte) (sharedKey []byte, err error)

Decapsulate generates a shared key from a ciphertext and a decapsulation key. If the decapsulation key or the ciphertext are not valid, Decapsulate returns an error.

The shared key must be kept secret.

func Encapsulate

func Encapsulate(encapsulationKey []byte) (ciphertext, sharedKey []byte, err error)

Encapsulate generates a shared key and an associated ciphertext from an encapsulation key, drawing random bytes from crypto/rand. If the encapsulation key is not valid, Encapsulate returns an error.

The shared key must be kept secret.

func GenerateKey

func GenerateKey() (encapsulationKey, decapsulationKey []byte, err error)

GenerateKey generates an encapsulation key and a corresponding decapsulation key, drawing random bytes from crypto/rand.

The decapsulation key must be kept secret.

func NewKeyFromSeed

func NewKeyFromSeed(seed []byte) (encapsulationKey, decapsulationKey []byte, err error)

NewKeyFromSeed deterministically generates an encapsulation key and a corresponding decapsulation key from a 96-byte seed. The seed must be uniformly random.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL