crypto

package
v0.0.0-...-7234002 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveKeys

func DeriveKeys(secret, salt []byte) (encKey, authKey []byte)

PBKDF2 for generating encryption and auth keys, derived from secret/salt. Returns two keys; 32-byte encryption key (AES-256) and 64-byte auth key (SHA1).

func Salt

func Salt() ([]byte, error)

Create a new cyptographically secure salt for hashing passwords.

Types

type Crypter

type Crypter interface {
	Encrypt(plaintext []byte) (ciphertext []byte, err error)
	Decrypt(ciphertext []byte) (plaintext []byte, err error)
	EncryptReader(plaintext io.Reader) (ciphertext io.Reader, err error)
	DecryptReader(ciphertext io.Reader) (plaintext io.Reader, err error)
}

func NewCrypter

func NewCrypter(encKey, authKey []byte) (Crypter, error)

Encrypt and decrypt using AES-256 in CBC (block chaining) mode. The ciphertext is signed/authenticated by an HMAC-SHA1 signature. Our encryption envelope consists of (iv||ciphertext||hmac).

Jump to

Keyboard shortcuts

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