Documentation
¶
Overview ¶
Package boxer is a streaming encryption implementation, based on Adam Langley's article: https://www.imperialviolet.org/2014/06/27/streamingencryption.html
In short, nacl/secretbox is used to seal a file in chunks, with each chunk being prefixed with its length. The nonce is incrementally marked so chunks are guaranteed to be in order. The encrypted blob is prepended with a header containing a version ID, the maximum chunk size, and flags. The flags are currently unused, but may be used in future versions.
Index ¶
Constants ¶
const ( // DefaultChunkSize is the default maximum chunk size for reading and // writing. DefaultChunkSize = 65536 // Overhead is the number of bytes of overhead when boxing a message. Overhead = secretbox.Overhead )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Decryptor ¶
type Decryptor struct {
// contains filtered or unexported fields
}
Decryptor is an io.ReadCloser that reads encrypted data written by an Encryptor.
func NewDecryptor ¶
NewDecryptor returns a new Decryptor. Nonce and key should be identical to the values originally passed to NewEncryptor.
Neither nonce or key are modified.
type Encryptor ¶
type Encryptor struct {
// contains filtered or unexported fields
}
Encryptor is an io.WriteCloser. Writes to an Encryptor are encrypted and written to w.
func NewEncryptor ¶
NewEncryptor creates an Encryptor with the default chunk size.
func NewEncryptorSize ¶
NewEncryptor returns a new Encryptor. Writes to the returned Encryptor are encrypted and written to w. The size parameter dictates the maximum chunk size. It should be a positive integer in the range [0, 1 << 32 - 1]. Writes will always be chunk size + Overhead.
All writes will not be flushed until Close is called. Not closing an Encryptor will rsult in an invalid stream.
Neither nonce or key are modified.