kem

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (i.KemExchangeProvider, error)

Types

type KyberExchange

type KyberExchange struct {
	Type       int
	PrivateKey *kyber.PrivateKey
	PublicKey  *kyber.PublicKey
}

KyberExchange is a Kyber512 KEM

func (*KyberExchange) Export

func (k *KyberExchange) Export() ([]byte, error)

Export writes the entire object to a byte slice for writing to disk

func (*KyberExchange) Import

func (k *KyberExchange) Import(export []byte) error

Import imports the entire object from disk

func (*KyberExchange) Public

func (k *KyberExchange) Public() []byte

Public packs the public key into a byte slice for use with the recipient's k.Send

func (*KyberExchange) Receive

func (k *KyberExchange) Receive(ct []byte) []byte

Receive processes the ciphertext received from the sender (using this instance's k.Public key) into a shared secret.

func (*KyberExchange) Send

func (k *KyberExchange) Send(recipientPackedPublicKey []byte) ([]byte, []byte)

Send generates the shared secret and the cipher text (using the recipient's `k.Public()`) to send it to the recipient

type KyberExchangeExport

type KyberExchangeExport struct {
	Type       int
	PrivateKey [kyber.PrivateKeySize]byte
	PublicKey  [kyber.PublicKeySize]byte
}

KyberExchangeExport is used for writing KyberExchange to disk

Jump to

Keyboard shortcuts

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