subtle

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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.

Jump to

Keyboard shortcuts

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