Documentation ¶
Index ¶
- Variables
- func DecryptFile(pass []byte, fileIn, fileOut string) error
- func EncryptFile(pass []byte, cp v1.CostParams, fileIn, fileOut string) error
- func NewDec(pass []byte, r io.ReadSeeker) (io.ReadCloser, error)
- func NewEnc(pass []byte, cp v1.CostParams, w io.Writer) (io.WriteCloser, error)
- type ErrVerMissing
Constants ¶
This section is empty.
Variables ¶
var ( // supported versions Versions = ldtools.NewVersionMap(v1.Version) ErrBadVer = errors.New("failed to read encryption version") )
Functions ¶
func DecryptFile ¶
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