crypto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package crypto defines additional interfaces that will be added to the crypto package in Go 1.26+.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decapsulator

type Decapsulator interface {
	Encapsulator() Encapsulator
	Decapsulate(ciphertext []byte) (sharedKey []byte, err error)
}

Decapsulator is an interface for an opaque private KEM key that can be used for decapsulation operations. For example, an ML-KEM key kept in a hardware module.

It will be implemented by crypto/mlkem.DecapsulationKey768 in Go 1.26+. In the meantime, use DecapsulatorFromDecapsulationKey768 and DecapsulatorFromDecapsulationKey1024.

func DecapsulatorFromDecapsulationKey1024

func DecapsulatorFromDecapsulationKey1024(dk *mlkem.DecapsulationKey1024) Decapsulator

DecapsulatorFromDecapsulationKey1024 wraps an ML-KEM-1024 decapsulation key into a Decapsulator, until Go 1.26+ where crypto/mlkem.DecapsulationKey1024 implements it natively.

func DecapsulatorFromDecapsulationKey768

func DecapsulatorFromDecapsulationKey768(dk *mlkem.DecapsulationKey768) Decapsulator

DecapsulatorFromDecapsulationKey768 wraps an ML-KEM-768 decapsulation key into a Decapsulator, until Go 1.26+ where crypto/mlkem.DecapsulationKey768 implements it natively.

type Encapsulator

type Encapsulator interface {
	Bytes() []byte
	Encapsulate() (sharedKey, ciphertext []byte)
}

Encapsulator is an interface for a public KEM key that can be used for encapsulation operations.

It is implemented, for example, by crypto/mlkem.EncapsulationKey768.

type KeyExchanger

type KeyExchanger interface {
	PublicKey() *ecdh.PublicKey
	Curve() ecdh.Curve
	ECDH(*ecdh.PublicKey) ([]byte, error)
}

KeyExchanger is an interface for an opaque private key that can be used for key exchange operations. For example, an ECDH key kept in a hardware module.

It is implemented by ecdh.PrivateKey.

Directories

Path Synopsis
Package ecdh defines an additional interface that will be added to the crypto/ecdh package in Go 1.26+.
Package ecdh defines an additional interface that will be added to the crypto/ecdh package in Go 1.26+.