encrypt

package
v0.0.0-...-8218a20 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeIdentity Mode = iota
	ModeUnknown
	ModeAESCTR
	ModeAESCFB
	ModeAESOFB
	ModeAESRec = ModeAESCTR

	ModeIdentityName = "identity"
	ModeAESCTRName   = "aes-ctr"
	ModeAESCFBName   = "aes-cfb"
	ModeAESOFBName   = "aes-ofb"
	ModeAESRecName   = "aes-rec"
	ModeUknownName   = "unknown"
)

Enumerate available modes and their textual names

Variables

This section is empty.

Functions

func MakeRandomAESKey

func MakeRandomAESKey() ([]byte, error)

MakeRandomAESKey generates AES-256 (32 byte) key securely by using a cryptographic entropy source

func NewEncryptedContainer

func NewEncryptedContainer(container stow.Container, mode Mode, key []byte) stow.Container

NewEncryptedContainer wraps the provided container in transparent encryption and decryption

func ValidAESKey

func ValidAESKey(key []byte) error

ValidAESKey confirms the provided key is the correct length for AES/128/224/256 and is not all zeros

Types

type Mode

type Mode uint8

Mode represents an encryption mode

func ModeFromName

func ModeFromName(name string) Mode

ModeFromName constructs a Mode from a textual name

func (Mode) AlgoName

func (m Mode) AlgoName() string

AlgoName returns the textual name of a Mode

func (Mode) NewReader

func (m Mode) NewReader(rdr io.Reader, key, initVect []byte) (io.Reader, error)

NewReader constructs a reader wrapper that applies this mode's decryption

func (Mode) NewWriter

func (m Mode) NewWriter(wtr io.WriteCloser, key []byte) (encryptor io.WriteCloser, initVect []byte, err error)

NewWriter constructs a writer wrapper that applies this mode's encryption

func (Mode) String

func (m Mode) String() string

String is a synonym for AlgoName

Jump to

Keyboard shortcuts

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