diff options
author | Jakob Unterwurzacher | 2015-11-25 19:30:32 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-11-25 20:57:16 +0100 |
commit | 4d466c3412918346144dff609d8f706c6f002581 (patch) | |
tree | 2624a1b9573295e6f70df6eb74be5d0f241436e7 /main.go | |
parent | d8bf6e7836a22c755fa0881f89d482b5e8f47e29 (diff) |
diriv: Create gocryptfs.diriv in every directory
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,6 +1,7 @@ package main import ( + "io/ioutil" "flag" "fmt" "os" @@ -43,6 +44,18 @@ func initDir(args *argContainer) { os.Exit(ERREXIT_INIT) } + // Create gocryptfs.diriv in the root dir + diriv := cryptfs.RandBytes(cryptfs.DIRIV_LEN) + dirivPath := filepath.Join(args.cipherdir, cryptfs.DIRIV_FILENAME) + cryptfs.Debug.Printf("Creating %s\n", dirivPath) + // 0444 permissions: the file is not secret but should not be written to + err = ioutil.WriteFile(dirivPath, diriv, 0444) + if err != nil { + fmt.Println(err) + os.Exit(ERREXIT_INIT) + } + + // Create gocryptfs.conf cryptfs.Info.Printf("Choose a password for protecting your files.\n") password := readPasswordTwice(args.extpass) err = cryptfs.CreateConfFile(args.config, password, args.plaintextnames) |