cryptdo

package
v0.0.0-...-ea797f3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: BSD-3-Clause Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyMessage = errors.New("cryptdo: empty message")

ErrEmptyMessage is caused by trying to decrypt and empty function.

View Source
var ErrEmptyPassphase = errors.New("cryptdo: passphrase must not be empty")

ErrEmptyPassphase is returned when the user does not type a passphrase before pressing return.

Functions

func Decrypt

func Decrypt(ciphertext []byte, passphrase string) ([]byte, error)

Decrypt decrypts a piece of ciphertext which was encrypted with the Encrypt function. The original plaintext is returned if no error occured during the decryption. It supports passing in ciphertext which was made with previous versions of the library.

The output format and internal details of the cryptography performed is documented in the associated protocol buffers file.

Due to the use of authenticated encryption we need to read the entire ciphertext into memory. Therefore it is recommended to only use this for smaller plaintexts.

func Encrypt

func Encrypt(plaintext []byte, passphrase string) ([]byte, error)

Encrypt takes a plaintext blob and encrypts it with a key based on the passphrase provided. The byte slice returned is suitable for passing in to the Decrypt function with the same passphrase in order to retrieve the data.

The output format and internal details of the cryptography performed is documented in the associated protocol buffers file.

Due to the use of authenticated encryption we need to read the entire plaintext into memory. Therefore it is recommended to only use this for smaller plaintexts.

func ReadPassphrase

func ReadPassphrase(prompt string) (string, error)

ReadPassphrase presents a prompt to the user before allowing them to type a passphrase without echoing the characters they type back to the terminal. It returns ErrEmptyPassphase if the user does not enter a passphrase.

Types

type InvalidNonceError

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

InvalidNonceError is caused by a mismatch between the expected nonce length from the encryption algorithm and the actual nonce length provided in the message.

func (*InvalidNonceError) Error

func (i *InvalidNonceError) Error() string

type UnknownVersionError

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

UnknownVersionError is caused when a message is too new for the executed version to understand. This will often be caused by a mismatch between two cryptography versions operating on the same data.

func (*UnknownVersionError) Error

func (u *UnknownVersionError) Error() string

Directories

Path Synopsis
cmd
internal
flag
Package flag contains flag unmarshalers for the github.com/jessevdk/go-flags parsing library.
Package flag contains flag unmarshalers for the github.com/jessevdk/go-flags parsing library.

Jump to

Keyboard shortcuts

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