package subtle

import "github.com/google/tink/go/prf/subtle"

Package subtle provides an implementation of PRFs like AES-CMAC.

Index

Functions

func ValidateAESCMACPRFParams

func ValidateAESCMACPRFParams(keySize uint32) error

ValidateAESCMACPRFParams checks that the key is the recommended size for AES-CMAC.

func ValidateHKDFPRFParams

func ValidateHKDFPRFParams(hash string, keySize uint32, salt []byte) error

ValidateHKDFPRFParams validates parameters of HKDF constructor.

func ValidateHMACPRFParams

func ValidateHMACPRFParams(hash string, keySize uint32) error

ValidateHMACPRFParams validates parameters of HMAC constructor.

Types

type AESCMACPRF

type AESCMACPRF struct {
	// contains filtered or unexported fields
}

AESCMACPRF is a type that can be used to compute several CMACs with the same key material.

func NewAESCMACPRF

func NewAESCMACPRF(key []byte) (*AESCMACPRF, error)

NewAESCMACPRF creates a new AESCMACPRF object and initializes it with the correct key material.

func (AESCMACPRF) ComputePRF

func (a AESCMACPRF) ComputePRF(data []byte, outputLength uint32) ([]byte, error)

ComputePRF computes the AES-CMAC for the given key and data, returning outputLength bytes. The timing of this function will only depend on len(data), and not leak any additional information about the key or the data.

type HKDFPRF

type HKDFPRF struct {
	// contains filtered or unexported fields
}

HKDFPRF is a type that can be used to compute several HKDFs with the same key material.

func NewHKDFPRF

func NewHKDFPRF(hashAlg string, key []byte, salt []byte) (*HKDFPRF, error)

NewHKDFPRF creates a new HKDFPRF object and initializes it with the correct key material.

func (HKDFPRF) ComputePRF

func (h HKDFPRF) ComputePRF(data []byte, outputLength uint32) ([]byte, error)

ComputePRF computes the HKDF for the given key and data, returning outputLength bytes.

type HMACPRF

type HMACPRF struct {
	// contains filtered or unexported fields
}

HMACPRF is a type that can be used to compute several HMACs with the same key material.

func NewHMACPRF

func NewHMACPRF(hashAlg string, key []byte) (*HMACPRF, error)

NewHMACPRF creates a new HMACPRF object and initializes it with the correct key material.

func (HMACPRF) ComputePRF

func (h HMACPRF) ComputePRF(data []byte, outputLength uint32) ([]byte, error)

ComputePRF computes the HMAC for the given key and data, returning outputLength bytes.

Source Files

aes_cmac.go hkdf.go hmac.go subtle.go

Version
v1.7.0 (latest)
Published
Aug 10, 2022
Platform
linux/amd64
Imports
9 packages
Last checked
3 months ago

Tools for package owners.