diff options
author | Jakob Unterwurzacher | 2015-10-11 17:14:18 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-10-11 17:14:18 +0200 |
commit | 5dc7e44aa2cb6527b0e2f4e7108c8cbd7c2a72c1 (patch) | |
tree | 30c9c35c0aaa5646ba90fee3efdfe4ea62550fed /gocryptfs_main/masterkey.go | |
parent | 6825d0e7406b8e761daca63770e28842bed5fd85 (diff) |
Move main files to top level dir
This is in preparation of getting rid of the shell wrapper
Diffstat (limited to 'gocryptfs_main/masterkey.go')
-rw-r--r-- | gocryptfs_main/masterkey.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/gocryptfs_main/masterkey.go b/gocryptfs_main/masterkey.go deleted file mode 100644 index 69f268c..0000000 --- a/gocryptfs_main/masterkey.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "encoding/hex" - "fmt" - "github.com/rfjakob/gocryptfs/cryptfs" - "os" - "strings" -) - -// printMasterKey - remind the user that he should store the master key in -// a safe place -func printMasterKey(key []byte) { - h := hex.EncodeToString(key) - var hChunked string - - // Try to make it less scary by splitting it up in chunks - for i := 0; i < len(h); i += 8 { - hChunked += h[i : i+8] - if i < 52 { - hChunked += "-" - } - if i == 24 { - hChunked += "\n " - } - } - - fmt.Printf(` -ATTENTION: - - Your master key is: %s - -If the gocryptfs.conf file becomes corrupted or you ever forget your password, -there is only one hope for recovery: The master key. Print it to a piece of -paper and store it in a drawer. - -`, hChunked) -} - -// Parse a hex-encoded master key that was passed on the command line -func parseMasterKey(masterkey string) []byte { - masterkey = strings.Replace(masterkey, "-", "", -1) - key, err := hex.DecodeString(masterkey) - if err != nil { - fmt.Printf("Could not parse master key: %v\n", err) - os.Exit(1) - } - if len(key) != cryptfs.KEY_LEN { - fmt.Printf("Master key has length %d but we require length %d\n", len(key), cryptfs.KEY_LEN) - os.Exit(1) - } - return key -} |