Documentation ¶
Index ¶
Constants ¶
View Source
const ( AEAD_AES_256_CBC_HMAC_SHA_512 = "AEAD_AES_256_CBC_HMAC_SHA_512" AEAD_AES_256_CBC_HMAC_SHA_512_ID = uint32(1) AEAD_CHACHA20_POLY1305_HMAC_SHA512 = "AEAD_CHACHA20_POLY1305_HMAC_SHA512" AEAD_CHACHA20_POLY1305_HMAC_SHA512_ID = uint32(2) )
Variables ¶
View Source
var ErrCounterMismatch = errors.New("lfcrypt: Counter mismatch in data block")
View Source
var ErrMetadataTooLarge = errors.New("lfcrypt: Metadata header is larger than 2^16")
View Source
var ErrNoMatchingKey = errors.New("lfcrypt: No valid key for decryption")
View Source
var ErrSealedBufferTooLarge = errors.New("lfcrypt: Sealed buffer came back larger than 2^16")
View Source
var ErrShortRandRead = errors.New("lfcrypt: rand.Read returned with less than the requested data")
View Source
var ErrShortRead = errors.New("lfcrypt: Short read")
View Source
var ErrShortWrite = errors.New("lfcrypt: Short write")
View Source
var ErrTrailingHMACMismatch = errors.New("lfcrypt: File trailing HMAC failed.")
View Source
var ErrUnknownCipher = errors.New("lfcrypt: Unknown cipher type in header")
View Source
var ErrUnknownHeader = errors.New("lfcrypt: Unknown header in encrypted file.")
Functions ¶
func ComputeKeyId ¶
Types ¶
type Cryptor ¶
type Cryptor interface { KeyId() uint32 Encrypt(r io.Reader, w io.Writer) error // Decrypts reader into writer. May return error after writer is partially written, so be sure to discard // the writers data in this case. Decrypt(r io.Reader, w io.Writer) error // Verify source reader is authenticated and valid. On success, seeks back to start of file. // Returns nil error if input is verified. Verify(r io.ReadSeeker) error }
func NewAES256SHA512 ¶
NewAES256SHA512 constructs a Cryptor with an AEAD construct with AES-256-CBC encryption and SHA-512 MACs using a 64-byte secret.
func NewCHACHA20POLY1305 ¶
NewCHACHA20POLY1305 constructs a Cryptor with an AEAD construct with ChaCha20-Poly1305 AEAD encryption and SHA-512 MACs using a 32-byte secret.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store contains a set of Cryptor instances to be used for decrypting a stream
Click to show internal directories.
Click to hide internal directories.