diff options
author | Jakob Unterwurzacher | 2015-11-27 21:48:58 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-11-27 21:48:58 +0100 |
commit | bdd9249a52d5ba2935625b9aeb12240214495e6f (patch) | |
tree | d04cffeee47a0db223075444442157c7e5eacde0 /cryptfs | |
parent | decfc1ab798055234e16a2e9c0782f56ae50669b (diff) |
diriv: Move WriteDirIV() to cryptfs; add locking to Mkdir, Rmdir
Diffstat (limited to 'cryptfs')
-rw-r--r-- | cryptfs/names_diriv.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cryptfs/names_diriv.go b/cryptfs/names_diriv.go index c9debab..1415bcb 100644 --- a/cryptfs/names_diriv.go +++ b/cryptfs/names_diriv.go @@ -21,6 +21,15 @@ func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) { return iv, nil } +// WriteDirIV - create diriv file inside "dir" (absolute path) +// This function is exported because it is used from pathfs_frontend +func (be *CryptFS) WriteDirIV(dir string) error { + iv := RandBytes(DIRIV_LEN) + file := filepath.Join(dir, DIRIV_FILENAME) + // 0444 permissions: the file is not secret but should not be written to + return ioutil.WriteFile(file, iv, 0444) +} + // EncryptPathDirIV - encrypt path using CBC with DirIV func (be *CryptFS) EncryptPathDirIV(plainPath string, rootDir string) (string, error) { if be.plaintextNames { |