ld

package
v0.0.0-...-fc24ea9 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// supported versions
	Versions = ldtools.NewVersionMap(v1.Version)

	ErrBadVer = errors.New("failed to read encryption version")
)

Functions

func DecryptFile

func DecryptFile(pass []byte, fileIn, fileOut string) error

DecryptFile will decrypt fileIn and store the plaintext result at fileOut

func EncryptFile

func EncryptFile(pass []byte, cp v1.CostParams, fileIn, fileOut string) error

EncryptFile will encrypt fileIn and store the encrypted result at fileOut

func NewDec

func NewDec(pass []byte, r io.ReadSeeker) (io.ReadCloser, error)

NewDec returns an io.ReadCloser that will decrypt r. If the provided password is incorrect, and ErrSigMismatch will be returned. ErrSigMismatch may also indicate the encrypted file was tampered with, as there is no way to know if the key was wrong or the file is compromised.

The returned io.ReadCloser, must be closed once it is no longer needed, in order to clear the derived key from protected memory.

func NewEnc

func NewEnc(pass []byte, cp v1.CostParams, w io.Writer) (io.WriteCloser, error)

NewEnc takes a password, key derivation cost parameters, and an io.Writer and returns an io.WriteCloser that encrypts the data written to it.

Close must be called on the returned io.WriteCloser when finished writing and before the underlying io.Writer is closed otherwise the WriteCloser will not know when to write signatures of the encrypted data

Types

type ErrVerMissing

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

func (ErrVerMissing) Error

func (e ErrVerMissing) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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