internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize = aes.BlockSize
)

Variables

This section is empty.

Functions

func Checksum

func Checksum(hash func() hash.Hash, key, data []byte) []byte

Checksum return data check sum hmac is computed from hashed data

func FromUUID

func FromUUID(data string) []byte

FromUUID return bytes from uuid string representation (see RFC 4122) reverse order is performed

func ReverseBytes

func ReverseBytes(s []byte) []byte

ReverseBytes reverse slice content

func ToUUID

func ToUUID(data []byte) uuid.UUID

ToUUID convert byte slice into uuid reverse order is performed data length must be 16 bytes

func Verify

func Verify(hash func() hash.Hash, key, data, checksum []byte) bool

Verify return true if checksum match computed checksum from data

Types

type BlockData

type BlockData [BlockSize]byte

BlockData used for aes operations

func HmacBlock

func HmacBlock(hash func() hash.Hash, key, data []byte) BlockData

HmacBlock compute hmac from hash and key. hmac is stored and returned into BlockData

func (*BlockData) Store

func (p *BlockData) Store(value interface{}) error

Store value into current BlockData

func (*BlockData) StoreBytes

func (p *BlockData) StoreBytes(data []byte) error

StoreBytes write data into current BlockData

func (*BlockData) StoreUInt64

func (p *BlockData) StoreUInt64(value uint64) error

StoreUInt64 write uint64 value into current BlockData

func (BlockData) String

func (p BlockData) String() string

func (*BlockData) UInt64

func (p *BlockData) UInt64() uint64

UInt64 retrieve uint64 value from current BlockData

type HkdfKeyGenerator

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

HkdfKeyGenerator for hkdf keys derivation

func (*HkdfKeyGenerator) NextKey

func (p *HkdfKeyGenerator) NextKey() ([]byte, error)

NextKey return next hkdf key with BlockSize length

type KeyGenerator

type KeyGenerator interface {
	NextKey() ([]byte, error)
}

KeyGenerator for key dérivation

func CreateKeyGenerator

func CreateKeyGenerator(hash func() hash.Hash, keyInfo KeyInfo) KeyGenerator

CreateKeyGenerator factory

type KeyInfo

type KeyInfo struct {
	Secret []byte // master secret key
	Salt   []byte // see crypto/hkdf
	Info   []byte // see crypto/hkdf
}

KeyInfo struct used for hkdf key derivation

func (*KeyInfo) Reverse

func (p *KeyInfo) Reverse()

Reverse KeyInfo data see secureid.Version0

func (*KeyInfo) Valid

func (p *KeyInfo) Valid() bool

Valid return true if KeyInfo is valid for crypto/hkdf

Jump to

Keyboard shortcuts

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