Documentation ¶
Overview ¶
lldb implements an encryption wrapper for "modernc.org/lldb".Filer. Ideally it can at some point be used to encrypt modernc.org/kv databases.
Index ¶
- Constants
- type Filer
- func (f Filer) BeginUpdate() error
- func (f Filer) Close() error
- func (f Filer) EndUpdate() error
- func (f Filer) Name() string
- func (f Filer) PunchHole(off, size int64) error
- func (f Filer) ReadAt(b []byte, off int64) (n int, err error)
- func (f Filer) Rollback() error
- func (f Filer) Size() (int64, error)
- func (f Filer) Sync() error
- func (f Filer) Truncate(sz int64) error
- func (f Filer) WriteAt(b []byte, off int64) (n int, err error)
- type NewBlockCipherFunc
- type NewXTSCipherFunc
- type Option
Constants ¶
const DefaultBlockSize = 4 * 1024
DefaultBlockSize is the default size of encrypted blocks. It is set to 4kB, because that is the block size of must underlying storage media.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filer ¶
type Filer struct {
// contains filtered or unexported fields
}
Filer wraps an lldb.Filer to add simple encryption.
func NewFiler ¶
NewFiler returns a new encrypted Filer that wraps filer, uses encryption key key and applies the supplied options opts.
func (Filer) BeginUpdate ¶
BeginUpdate starts an update transaction. Depending on the lower-level filer, this may be a no-op.
func (Filer) EndUpdate ¶
EndUpdate ends (commits) an update transaction. Depending on the lower-level filer, this may be a no-op.
func (Filer) PunchHole ¶
PunchHole punches a hole of size at offset off in the underlying filer. The behaviour depends on the wrapped filer. More information on what this does can be found in the lldb package documentation.
func (Filer) ReadAt ¶
ReadAt reads the data in the filer at offset off into b. The specific behaviour may depend on the wrapped filer. TODO verify that we bahave correctly according to io.ReaderAt
func (Filer) Rollback ¶
Rollback rolls back the most recently started and not yet ended/rolled back update transaction. Depending on the wrapped filer, this may be a no-op.
func (Filer) Size ¶
Size returns the size of the filer. At this point, the encryption does not provide any authentication, so the size of the plaintext is the same as the size of the ciphertext.
func (Filer) Sync ¶
Sync triggers the syncing of written data to disk. It only calls the same method on the wrapped filer.
type NewBlockCipherFunc ¶
NewBlockCipherFunc is a function that initialized a block cipher based on the supplied key.
type NewXTSCipherFunc ¶
NewXTSCipherFunc is a function that returns an XTS cipher based on the supplied key. This can be used to use XTS with a different block cipher than AES.
type Option ¶
Option is the functional option type for Filer.
func WithBlockCipher ¶
func WithBlockCipher(newBlockCipher NewBlockCipherFunc) Option
WithBlockCipher returns an option that sets the block cipher to the one specified by newBlockCipher.
func WithBlockSize ¶
WithBlockSize returns an option that sets the block size to blockSize.