Documentation
¶
Overview ¶
Package cryptostream implements transparent encryption on ReaderAt and Writer streams in order to enforce encrypted backups
Index ¶
Constants ¶
const HeaderSize = aes.BlockSize
HeaderSize represents the metadata size prepended to the data stream and needs to be subtracted when passing the payload size by using the file size of the encrypted data
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CryptoReaderAt ¶
type CryptoReaderAt struct {
// contains filtered or unexported fields
}
CryptoReaderAt implements an io.ReaderAt on an AES-256-CTR encrypted data stream. The data stream is expected to have the format defined in this library.
func NewReaderAt ¶
func NewReaderAt(next io.ReaderAt, pass []byte) (CryptoReaderAt, error)
NewReaderAt creates a new CryptoReaderAt on the given io.ReaderAt, reads header and salt and verifies the stream follows the format specified in this library.
type CryptoWriteCloser ¶
type CryptoWriteCloser struct {
// contains filtered or unexported fields
}
CryptoWriteCloser implements an io.Writer following the specification of this package onto a given io.Writer
func NewWriter ¶
func NewWriter(next io.Writer, pass []byte) (*CryptoWriteCloser, error)
NewWriter creates a new CryptoWriteCloser, gets a random salt and writes the header to the underlying writer
func (*CryptoWriteCloser) Close ¶
func (c *CryptoWriteCloser) Close() error
Close implements the io.Closer interface and MUST be called after all writes are finished as the Write method might NOT have written all data to the underlying writer. This method ensures the data is fully and properly written