cipherfactory

package
v0.0.0-...-b84bf83 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2014 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficientKeySource = errors.New("Not enough data to create a proper encryption key")
	ErrInvalidKey            = errors.New("Invalid key")
	ErrUnknownKeyType        = errors.New("Unknown key type")
)

Functions

This section is empty.

Types

type Factory

type Factory interface {

	// Get minimum number of bytes in the key source
	GetMinKeySourceBytes() int

	// TODO: Shouldn't we operate on io.WriterCloser here ?
	// Create io.Writer to encrypt data writter and save to provided writer,
	// Parameters:
	//   keySource - byte blob used as source for the key computation
	//   ivSource  - byte blob used as source for the iv computation
	//   output    - writer used as the output for produced bytes
	// Returns:
	//   writer - writer where plain data should be written
	//   key    - key in string form that can be used to create decryptor
	//   err    - error
	CreateEncryptor(keySource, ivSource []byte, output io.Writer) (writer io.Writer, key string, err error)

	// Create a decryptor from key (returned from CreateEncryptor function) and iv source,
	// Similarly to CreateEncryptor, this function returns reader that can be used to read
	// plain data, one must provide source data reader that should allow reading encrypted data
	CreateDecryptor(key string, ivSource []byte, input io.Reader) (reader io.Reader, err error)

	// Create default hasher
	CreateHasher() (hasher hash.Hash, err error)
}

Interface for the provider of encryption primitives used in Cinode

func Create

func Create() Factory

Create default factory

Jump to

Keyboard shortcuts

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