cipherfactory

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEncryptionConfig is used as an error when given string representation if the
	// key can not be interpreted
	ErrInvalidEncryptionConfig = errors.New("invalid encryption config")

	ErrInvalidEncryptionConfigKeyType = fmt.Errorf("%w: wrong key type", ErrInvalidEncryptionConfig)
	ErrInvalidEncryptionConfigKeySize = fmt.Errorf("%w: wrong XChaCha20 key size, expected %d bytes", ErrInvalidEncryptionConfig, chacha20.KeySize+1)
	ErrInvalidEncryptionConfigIVSize  = fmt.Errorf("%w: wrong XChaCha20 iv size, expected %d bytes", ErrInvalidEncryptionConfig, chacha20.NonceSizeX)
)

Functions

func DefaultIV added in v0.0.7

func DefaultIV(k *common.BlobKey) *common.BlobIV

func StreamCipherReader

func StreamCipherReader(key *common.BlobKey, iv *common.BlobIV, r io.Reader) (io.Reader, error)

func StreamCipherWriter

func StreamCipherWriter(key *common.BlobKey, iv *common.BlobIV, w io.Writer) (io.Writer, error)

Types

type IVGenerator

type IVGenerator interface {
	io.Writer
	Generate() *common.BlobIV
}

func NewIVGenerator

func NewIVGenerator(t common.BlobType) IVGenerator

type KeyGenerator

type KeyGenerator interface {
	io.Writer
	Generate() *common.BlobKey
}

func NewKeyGenerator

func NewKeyGenerator(t common.BlobType) KeyGenerator

Jump to

Keyboard shortcuts

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