kdbcrypt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kdbcrypt encrypts and decrypts data using the KeePass1 encryption scheme.

Index

Constants

View Source
const BlockSize = 16

Block size in bytes.

Variables

View Source
var (
	ErrUnknownCipher = errors.New("keepass: unknown cipher")
	ErrSize          = errors.New("keepass: data size not a multiple of 16")
)

Errors

Functions

func NewDecrypter

func NewDecrypter(r io.Reader, params *Params) (io.Reader, error)

NewDecrypter creates a new reader that decrypts and strips padding from r.

func NewEncrypter

func NewEncrypter(w io.Writer, params *Params) (io.WriteCloser, error)

NewEncrypter creates a new writer that encrypts to w. Closing the new writer writes the final, padded block but does not close w.

func ReadKeyFile

func ReadKeyFile(r io.Reader) ([]byte, error)

ReadKeyFile reads a key file and returns its hash for use in a Key.

Types

type Cipher

type Cipher int

Cipher is a cipher algorithm.

const (
	RijndaelCipher Cipher = iota
	TwofishCipher
)

Available ciphers

type ComputedKey added in v0.2.2

type ComputedKey []byte

A ComputedKey is the encryption key that is directly passed to the cipher, derived from a Key. Since computing a key is slow by design, if you intend to decrypt and encrypt a database multiple times in quick succession, this will be much faster.

type Key

type Key struct {
	Password        []byte // optional
	KeyFileHash     []byte // must be nil or length 16
	MasterSeed      [16]byte
	TransformSeed   [32]byte
	TransformRounds uint32
}

A Key is the set of parameters used to build the cipher key.

func (*Key) Compute added in v0.2.2

func (k *Key) Compute() ComputedKey

Compute derives the actual cipher key from the user-specifiable parameters.

type Params

type Params struct {
	Key         Key
	ComputedKey ComputedKey // if non-nil, this will be used instead of Key.
	Cipher      Cipher
	IV          [16]byte
}

Params specifies the encryption/decryption values.

Jump to

Keyboard shortcuts

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