crypto

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2014 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SymetricKeyLength is the length in bytes of the key used with the
	// AES-256 algorithm
	SymetricKeyLength = 32

	// HmacKeyLength is the length in bytes of the key used in the HMAC
	// SHA-512 algorithm
	HmacKeyLength = 128

	// HmacOutputLength is the length in bytes of the sum produced by the HMAC
	// SHA-512 algorithm.
	HmacOutputLength = 64
)

Variables

This section is empty.

Functions

func NewCrypter

func NewCrypter(key io.Reader) (*crypter, error)

New creates and returns a new crypter. Keys are obtained by reading from the provided reader.

func NewCrypterFromFile added in v0.5.0

func NewCrypterFromFile(filepath string) (*crypter, error)

func NewRandomCrypter added in v0.5.0

func NewRandomCrypter() (*crypter, error)

Types

type Crypter

type Crypter interface {
	EncryptString(plaintext string) (string, error)
	DecryptString(message string) (string, error)
}

A Crypter is an encrypter/decrypter.

type CrypterError

type CrypterError struct {
	Err string
}

CrypterError represents a run-time error in a crypter method.

func (CrypterError) Error

func (e CrypterError) Error() string

Jump to

Keyboard shortcuts

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