hpke

package
v0.0.0-...-bfa4f7b Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package hpke implements anonymous hybrid public key encryption using X25519 and ML-KEM-768.

Seal generates a fresh X25519 key and ML-KEM encapsulation for each message. The resulting shared secrets are combined in a Thyrse transcript and used to encrypt and authenticate the plaintext. The scheme authenticates the ciphertext, not its sender: anyone with the receiver's public keys can create a valid ciphertext.

Index

Constants

View Source
const (

	// Overhead is the size, in bytes, of the additional data added to a message by Seal.
	Overhead = headerSize + thyrse.TagSize
)

Variables

This section is empty.

Functions

func Open

func Open(
	domain string,
	receiver *ecdh.PrivateKey,
	receiverKEM *mlkem.DecapsulationKey768,
	ciphertext []byte,
) ([]byte, error)

Open decrypts a ciphertext produced by Seal using the receiver's X25519 and ML-KEM private keys.

func Seal

func Seal(
	domain string,
	receiver *ecdh.PublicKey,
	receiverKEM *mlkem.EncapsulationKey768,
	plaintext []byte,
) []byte

Seal encrypts plaintext for the owners of the receiver's X25519 and ML-KEM public keys.

Panics if the X25519 public key produces an invalid shared secret.

Types

This section is empty.

Jump to

Keyboard shortcuts

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