Documentation
¶
Overview ¶
Package enigma implements the simple encrypted filesystem.
The filesystem is specified a block cipher which is used to encrypt the subcipher of the filesystem. The subcipher is then used to encrypt the file names and data. The path of each file is taken into consideration while generating nonce.
Thanks to the CTR mode, the size of each files is the same size as their plain text one, and supports random access.
For nonce generation, a crypto random nonce will be generated for encrypting the cipher, while file names will have their corresponding nonce generated in a deterministic process. The file will be encrypted by their file names, which means each file must be re-encrypted when it is renamed.
Index ¶
- Constants
- func Init(inner afero.Fs, rootKey cipher.AEAD, path string, userConfig Config) error
- type Config
- type Fs
- func (efs *Fs) Chmod(name string, mode os.FileMode) error
- func (efs *Fs) Chown(name string, uid, gid int) error
- func (efs *Fs) Chtimes(name string, atime, mtime time.Time) error
- func (efs *Fs) Close()
- func (efs *Fs) Create(name string) (afero.File, error)
- func (efs *Fs) Merge(src, dst string) error
- func (efs *Fs) Mkdir(name string, perm os.FileMode) error
- func (efs *Fs) MkdirAll(name string, perm os.FileMode) error
- func (*Fs) Name() string
- func (efs *Fs) Open(name string) (afero.File, error)
- func (efs *Fs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (efs *Fs) Remove(name string) error
- func (efs *Fs) RemoveAll(name string) error
- func (efs *Fs) Rename(src, dst string) error
- func (efs *Fs) Stat(name string) (os.FileInfo, error)
- type Option
Constants ¶
const ( // CurrentVersion is the version of filesystem config. // // This field should be increment by one every time we // modify the layout of protobuf. The field is also used // to detect whether we support the specified filesystem. CurrentVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs implements the filesystem of enigma.
func New ¶
New the filesystem at specified path.
The specified filesystem must have been initialized by the Init function above, and generated with the same key as the specified one.
The root key is just used for decrypting the subcipher and no longer required after the filesystem is initialized.
func (*Fs) Close ¶
func (efs *Fs) Close()
Close the file system, removing locks and temporary files.
type Option ¶
type Option func(*option)
Option specified extra parameters for creating filesystem.
func WithCacheSize ¶
WithCacheSize sets the cache size of the internal LRU cache.
func WithOptions ¶
WithOptions specifies a set of options as a single option.
func WithReadWrite ¶
WithReadWrite implies the file system is read write mode.
The file system fails to initialize when there's another process on the same machine or remote file system has already claimed it.
The user can find out who is claiming it and restore it to normal state if they are sure this is unexpected.
func WithWriterName ¶
WithWriterName sets the instance name of the writer when it will be run in writer mode.
Adding this flag will replace the original writer name and is more semantic when the process is managed by us.