kdf

package
v0.0.0-...-331fbfb Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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

Jump to

Keyboard shortcuts

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