@@ -5,47 +5,13 @@ import (
5
5
"os"
6
6
"strings"
7
7
8
- "golang.org/x/crypto/ssh/terminal"
9
-
10
8
"github.com/rfjakob/gocryptfs/internal/configfile"
11
9
"github.com/rfjakob/gocryptfs/internal/cryptocore"
12
10
"github.com/rfjakob/gocryptfs/internal/exitcodes"
13
11
"github.com/rfjakob/gocryptfs/internal/readpassword"
14
12
"github.com/rfjakob/gocryptfs/internal/tlog"
15
13
)
16
14
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
-
49
15
// parseMasterKey - Parse a hex-encoded master key that was passed on the command line
50
16
// Calls os.Exit on failure
51
17
func parseMasterKey (masterkey string , fromStdin bool ) []byte {
@@ -106,9 +72,5 @@ func getMasterKey(args *argContainer) (masterkey []byte, confFile *configfile.Co
106
72
if ! args .trezor {
107
73
readpassword .CheckTrailingGarbage ()
108
74
}
109
- if ! args .fsck {
110
- // We only want to print the masterkey message on a normal mount.
111
- printMasterKey (masterkey )
112
- }
113
75
return masterkey , confFile
114
76
}
0 commit comments