internal

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package internal provides values, structures, and functions to operate OPAQUE that are not part of the public API.

Index

Constants

View Source
const (
	// NonceLength is the default length used for nonces.
	NonceLength = 32

	// SeedLength is the default length used for seeds.
	SeedLength = 32
)

Variables

View Source
var ErrConfigurationInvalidLength = errors.New("invalid encoded configuration length")

ErrConfigurationInvalidLength happens when deserializing a configuration of invalid length.

Functions

func RandomBytes

func RandomBytes(length int) []byte

RandomBytes returns random bytes of length len (wrapper for crypto/rand).

Types

type Configuration

type Configuration struct {
	KDF          *KDF
	MAC          *Mac
	Hash         *Hash
	KSF          *KSF
	OPRF         oprf.Identifier
	Context      []byte
	NonceLen     int
	EnvelopeSize int
	Group        group.Group
}

TODO: Configuration is the internal representation of the instance runtime parameters.

type Hash

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

Hash wraps a hash function and exposes only necessary hashing methods.

func NewHash

func NewHash(id crypto.Hash) *Hash

NewHash returns a newly instantiated Hash.

func (*Hash) Size

func (h *Hash) Size() int

Size returns the output size of the hashing function.

func (*Hash) Sum

func (h *Hash) Sum() []byte

Sum returns the current hash of the running state.

func (*Hash) Write

func (h *Hash) Write(p []byte)

Write adds input to the running state.

type IdentityKSF

type IdentityKSF struct{}

IdentityKSF represents a KSF with no operations.

func (IdentityKSF) Harden

func (i IdentityKSF) Harden(password, _ []byte, _ int) []byte

Harden returns the password as is.

type KDF

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

KDF wraps a hash function and exposes KDF methods.

func NewKDF

func NewKDF(id crypto.Hash) *KDF

NewKDF returns a newly instantiated KDF.

func (*KDF) Expand

func (k *KDF) Expand(key, info []byte, length int) []byte

Expand exposes an Expand only KDF method.

func (*KDF) Extract

func (k *KDF) Extract(salt, ikm []byte) []byte

Extract exposes an Extract only KDF method.

func (*KDF) Size

func (k *KDF) Size() int

Size returns the output size of the Extract method.

type KSF

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

KSF wraps a key stretching function and exposes its functions.

func NewKSF

func NewKSF(id ksf.Identifier) *KSF

NewKSF returns a newly instantiated KSF.

type Mac

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

Mac wraps a hash function and exposes Message Authentication Code methods.

func NewMac

func NewMac(id crypto.Hash) *Mac

NewMac returns a newly instantiated Mac.

func (*Mac) Equal

func (m *Mac) Equal(a, b []byte) bool

Equal returns a constant-time comparison of the input.

func (*Mac) MAC

func (m *Mac) MAC(key, message []byte) []byte

MAC computes a MAC over the message using key.

func (*Mac) Size

func (m *Mac) Size() int

Size returns the MAC's output length.

Directories

Path Synopsis
Package ake provides high-level functions for the 3DH AKE.
Package ake provides high-level functions for the 3DH AKE.
Package encoding provides encoding utilities.
Package encoding provides encoding utilities.
Package keyrecovery provides utility functions and structures allowing credential management.
Package keyrecovery provides utility functions and structures allowing credential management.
Package masking provides the credential masking mechanism.
Package masking provides the credential masking mechanism.
Package oprf implements the Elliptic Curve Oblivious Pseudorandom Function (EC-OPRF) from https://tools.ietf.org/html/draft-irtf-cfrg-voprf.
Package oprf implements the Elliptic Curve Oblivious Pseudorandom Function (EC-OPRF) from https://tools.ietf.org/html/draft-irtf-cfrg-voprf.
Package tag provides the static tag strings to OPAQUE.
Package tag provides the static tag strings to OPAQUE.

Jump to

Keyboard shortcuts

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