@@ -5,47 +5,13 @@ import (
55 "os"
66 "strings"
77
8- "golang.org/x/crypto/ssh/terminal"
9-
108 "github.com/rfjakob/gocryptfs/internal/configfile"
119 "github.com/rfjakob/gocryptfs/internal/cryptocore"
1210 "github.com/rfjakob/gocryptfs/internal/exitcodes"
1311 "github.com/rfjakob/gocryptfs/internal/readpassword"
1412 "github.com/rfjakob/gocryptfs/internal/tlog"
1513)
1614
17- // printMasterKey - remind the user that he should store the master key in
18- // a safe place
19- func printMasterKey (key []byte ) {
20- if ! terminal .IsTerminal (int (os .Stdout .Fd ())) {
21- // We don't want the master key to end up in a log file
22- tlog .Info .Printf ("Not running on a terminal, suppressing master key display\n " )
23- return
24- }
25- h := hex .EncodeToString (key )
26- var hChunked string
27- // Try to make it less scary by splitting it up in chunks
28- for i := 0 ; i < len (h ); i += 8 {
29- hChunked += h [i : i + 8 ]
30- if i < 52 {
31- hChunked += "-"
32- }
33- if i == 24 {
34- hChunked += "\n "
35- }
36- }
37- tlog .Info .Printf (`
38- Your master key is:
39-
40- %s
41-
42- If the gocryptfs.conf file becomes corrupted or you ever forget your password,
43- there is only one hope for recovery: The master key. Print it to a piece of
44- paper and store it in a drawer. Use "-q" to suppress this message.
45-
46- ` , tlog .ColorGrey + hChunked + tlog .ColorReset )
47- }
48-
4915// parseMasterKey - Parse a hex-encoded master key that was passed on the command line
5016// Calls os.Exit on failure
5117func parseMasterKey (masterkey string , fromStdin bool ) []byte {
@@ -106,9 +72,5 @@ func getMasterKey(args *argContainer) (masterkey []byte, confFile *configfile.Co
10672 if ! args .trezor {
10773 readpassword .CheckTrailingGarbage ()
10874 }
109- if ! args .fsck {
110- // We only want to print the masterkey message on a normal mount.
111- printMasterKey (masterkey )
112- }
11375 return masterkey , confFile
11476}
0 commit comments