libsignalgo.mau.fi/libsignal/kdf Index | Files

package kdf

import "go.mau.fi/libsignal/kdf"

Package kdf provides a key derivation function to calculate key output and negotiate shared secrets for curve X25519 keys.

Index

Functions

func CalculateSharedSecret

func CalculateSharedSecret(theirKey, ourKey [32]byte) [32]byte

CalculateSharedSecret uses DH Curve25519 to find a shared secret. The result of this function should be used in `DeriveSecrets` to output the Root and Chain keys.

func DeriveSecrets

func DeriveSecrets(inputKeyMaterial, salt, info []byte, outputLength int) ([]byte, error)

DeriveSecrets derives the requested number of bytes using HKDF with the given input, salt, and info.

Types

type HKDF

type HKDF func(inputKeyMaterial, salt, info []byte, outputLength int) ([]byte, error)

HKDF is a hashed key derivation function type that can be used to derive keys.

type KeyMaterial

type KeyMaterial struct {
	CipherKey []byte
	MacKey    []byte
	IV        []byte
}

KeyMaterial is a structure for representing a cipherkey, mac, and iv

Source Files

HKDF.go

Version
v0.1.2 (latest)
Published
Feb 12, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
1 week ago

Tools for package owners.