kdf

package module
v0.0.0-...-ead800b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: LGPL-3.0 Imports: 5 Imported by: 1

Documentation

Overview

Package kdf implements the key derivation functions described in NIST SP-800-108 (see https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-108.pdf).

All 3 modes are implemented - counter, feedback and pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CounterModeKey

func CounterModeKey(prf PRF, key, label, context []byte, bitLength uint32) []byte

CounterModeKey derives a key of the specified length using the counter mode function described in NIST SP-800-108, using the supplied PRF, secret key and other input parameters.

func FeedbackModeKey

func FeedbackModeKey(prf PRF, key, label, context, iv []byte, bitLength uint32, useCounter bool) []byte

FeebackModeKey derives a key of the specified length using the feedback mode function described in NIST SP-800-108, using the supplied PRF, secret key and other input parameters.

The useCounter argument specifies whether the iteration counter should be included as an input to the PRF.

func PipelineModeKey

func PipelineModeKey(prf PRF, key, label, context []byte, bitLength uint32, useCounter bool) []byte

PipelineModeKey derives a key of the specified length using the double-pipeline iteration mode function described in NIST SP-800-108, using the supplied PRF, secret key and other input parameters.

The useCounter argument specifies whether the iteration counter should be included as an input to the PRF.

Types

type PRF

type PRF interface {
	// Len returns the length of this PRF.
	Len() uint32

	// Run computes bytes for the supplied seed and input value.
	Run(s, x []byte) []byte
}

PRF represents a pseudorandom function, required by the key derivation functions.

func NewHMACPRF

func NewHMACPRF(h crypto.Hash) PRF

NewHMACPRF creates a new HMAC based PRF using the supplied digest algorithm.

Jump to

Keyboard shortcuts

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