crypto

package
v0.0.0-...-45df14b Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomSecret

func RandomSecret() (string, error)

func RandomThing

func RandomThing(byteLength int, checksum bool) (string, error)

Types

type Cryptor

type Cryptor interface {
	Encryptor
	Decryptor
}

func NewAES128SHA256

func NewAES128SHA256(secret []byte) (Cryptor, error)

32-byte secret

func NewChacha20poly1305

func NewChacha20poly1305(secret []byte) (Cryptor, error)

32-byte secret

func NewFromConf

func NewFromConf(c *common.Conf) (Cryptor, error)

type Decryptor

type Decryptor interface {
	Decrypt(io.Reader, io.Writer) error
}

type Encryptor

type Encryptor interface {
	Encrypt(io.Reader, io.Writer) error
}

type EtmCryptor

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

func (*EtmCryptor) Decrypt

func (e *EtmCryptor) Decrypt(r io.Reader, w io.Writer) error

func (*EtmCryptor) Encrypt

func (e *EtmCryptor) Encrypt(r io.Reader, w io.Writer) error

Encrypts an cleartext input Reader in 1 megabyte chunks.

File Format:

Header: 10 bytes for version and cipher identification.

"distsync01": v1, AEAD_AES_128_CBC_HMAC_SHA_256.
"distsync02": v2, AEAD_CHACHA20_POLY1305

Data block(s):

4-bytes chunk size. (PutUint32)
AEAD encrypted data. (up to `v1maxChunkSize`)

Trailing hash block:

0 byte data block, followed by:
mac []byte: 32 byte HMAC of file's contents.

Jump to

Keyboard shortcuts

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