Documentation ¶
Index ¶
- func DecodeReader(r io.Reader, c Codec, key *[32]byte, startingBlockNum int64) io.Reader
- func EncodeReader(r io.Reader, c Codec, key *[32]byte, startingBlockNum int64) io.Reader
- type Codec
- type CodecMap
- type EncWrapper
- func (e *EncWrapper) Close() error
- func (e *EncWrapper) Delete(ctx context.Context, path string) error
- func (e *EncWrapper) Get(ctx context.Context, path string, offset, length int64) (io.ReadCloser, error)
- func (e *EncWrapper) List(ctx context.Context, prefix string, ...) error
- func (e *EncWrapper) Put(ctx context.Context, path string, data io.Reader) error
- type HMACKeyGenerator
- type KeyGenerator
- type SecretboxCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeReader ¶
DecodeReader applies a Codec's decoding to a given reader, starting at the given startingBlockNum (usually 0).
Types ¶
type Codec ¶
type Codec interface { EncodedBlockSize() int DecodedBlockSize() int Encode(out, in []byte, key *[32]byte, blockNum int64) ([]byte, error) Decode(out, in []byte, key *[32]byte, blockNum int64) ([]byte, error) }
A Codec concisely represents a reversible transformation that might be applied to a data stream, such as encryption.
type CodecMap ¶
type CodecMap struct {
// contains filtered or unexported fields
}
func NewCodecMap ¶
func (*CodecMap) CodecForPath ¶
type EncWrapper ¶
type EncWrapper struct {
// contains filtered or unexported fields
}
EncWrapper wraps a Backend with encryption.
func NewEncWrapper ¶
func NewEncWrapper(encryption *CodecMap, keyGen KeyGenerator, backend backends.Backend) *EncWrapper
NewEncWrapper returns a new Backend with the provided encryption
func (*EncWrapper) Close ¶
func (e *EncWrapper) Close() error
func (*EncWrapper) Delete ¶
func (e *EncWrapper) Delete(ctx context.Context, path string) error
Delete implements the Backend interface
func (*EncWrapper) Get ¶
func (e *EncWrapper) Get(ctx context.Context, path string, offset, length int64) (io.ReadCloser, error)
Get implements the Backend interface
type HMACKeyGenerator ¶
type HMACKeyGenerator struct {
// contains filtered or unexported fields
}
HMACKeyGenerator is a KeyGenerator that simply SHA256-HMACs the provided root key with any given full path.
func NewHMACKeyGenerator ¶
func NewHMACKeyGenerator(rootKey []byte) *HMACKeyGenerator
func (*HMACKeyGenerator) KeyForPath ¶
func (s *HMACKeyGenerator) KeyForPath(path string) (key [32]byte)
type KeyGenerator ¶
A KeyGenerator determines the encryption key to use for a given backend path
type SecretboxCodec ¶
type SecretboxCodec struct {
// contains filtered or unexported fields
}
SecretboxCodec provides the NaCl 'secretbox' encryption scheme as a Codec. Nonces are monotonic with blocks starting with 0.
func NewSecretboxCodec ¶
func NewSecretboxCodec(unencryptedBlockSize int) *SecretboxCodec
NewSecretboxCodec creates a SecretboxCodec with the given unencrypted block size. A good choice here is 16*1024, or 16*1024-secretbox.Overhead, depending on your alignment needs.
func (*SecretboxCodec) DecodedBlockSize ¶
func (s *SecretboxCodec) DecodedBlockSize() int
func (*SecretboxCodec) EncodedBlockSize ¶
func (s *SecretboxCodec) EncodedBlockSize() int