crypto

package
v0.0.0-...-01ee8fb Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypter

type Crypter interface {
	// Append to dst and return updated slice.
	Encrypt(dst, plaintext []byte) (result []byte, err error)

	Decrypt(ciphertext []byte) (plaintext []byte, err error)
}

A Crypter knows how to encrypt and decrypt arbitrary byte strings.

func NewCrypter

func NewCrypter(key []byte) (Crypter, error)

Return a crypter configured to use AES-SIV deterministic decryption with authentication (see RFC 5297) with the supplied key. The key must be 32, 48, or 64 bytes long.

type KeyDeriver

type KeyDeriver interface {
	DeriveKey(password string, salt []byte) []byte
}

An object that knows how to derive a crypto key, given a user password and a random salt.

func NewPbkdf2KeyDeriver

func NewPbkdf2KeyDeriver(iters int, keyLen int, h func() hash.Hash) KeyDeriver

Create a key deriver that uses the PBKDF2 key derivation function of RFC 2898 / PKCS #5 v2.0.

type NotAuthenticError

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

*NotAuthenticError may be returned by Crypter.Decrypt if the input is otherwise well-formed but the ciphertext doesn't check out as authentic. This could be due to an incorrect key or corrupted ciphertext.

func (*NotAuthenticError) Error

func (e *NotAuthenticError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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