aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-15 23:59:57 +0200
committerJakob Unterwurzacher2015-09-15 23:59:57 +0200
commit3be2dfdf9dbb6d57105217933fb3ac80d7959202 (patch)
treedc2da9c2c37f6cbca9b9ec84cf6271626fe33275 /main.go
parent69b3d53f2192e2fe3def0f120bc96acb480329e8 (diff)
Add "--zerokey" option to simplify testing and benchmarking
Diffstat (limited to 'main.go')
-rw-r--r--main.go43
1 files changed, 25 insertions, 18 deletions
diff --git a/main.go b/main.go
index d992a17..4563b9c 100644
--- a/main.go
+++ b/main.go
@@ -66,8 +66,10 @@ func main() {
// Parse command line arguments
var debug bool
var init bool
+ var zerokey bool
flag.BoolVar(&debug, "debug", false, "Enable debug output")
flag.BoolVar(&init, "init", false, "Initialize encrypted directory")
+ flag.BoolVar(&zerokey, "zerokey", false, "Use all-zero dummy master key")
flag.Parse()
if debug {
cryptfs.Debug.Enable()
@@ -81,7 +83,7 @@ func main() {
initDir(flag.Arg(0))
}
if flag.NArg() < 2 {
- fmt.Printf("usage: %s CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME)
+ fmt.Printf("usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME)
os.Exit(ERREXIT_USAGE)
}
cipherdir, _ := filepath.Abs(flag.Arg(0))
@@ -94,24 +96,29 @@ func main() {
os.Exit(ERREXIT_CIPHERDIR)
}
- cfname := filepath.Join(cipherdir, cryptfs.ConfDefaultName)
- _, err = os.Stat(cfname)
- if err != nil {
- fmt.Printf("Error: %s not found in CIPHERDIR\n", cryptfs.ConfDefaultName)
- fmt.Printf("Please run \"%s --init %s\" first\n", PROGRAM_NAME, flag.Arg(0))
- os.Exit(ERREXIT_LOADCONF)
- }
-
- fmt.Printf("Password: ")
- password := readPassword()
- fmt.Printf("\nDecrypting master key... ")
- key, err := cryptfs.LoadConfFile(cfname, password)
- if err != nil {
- fmt.Println(err)
- os.Exit(ERREXIT_LOADCONF)
+ key := make([]byte, cryptfs.KEY_LEN)
+ if zerokey {
+ fmt.Printf("Zerokey mode active: using all-zero dummy master key.\n")
+ fmt.Printf("ZEROKEY MODE PROVIDES NO SECURITY AT ALL.\n")
+ } else {
+ cfname := filepath.Join(cipherdir, cryptfs.ConfDefaultName)
+ _, err = os.Stat(cfname)
+ if err != nil {
+ fmt.Printf("Error: %s not found in CIPHERDIR\n", cryptfs.ConfDefaultName)
+ fmt.Printf("Please run \"%s --init %s\" first\n", PROGRAM_NAME, flag.Arg(0))
+ os.Exit(ERREXIT_LOADCONF)
+ }
+ fmt.Printf("Password: ")
+ password := readPassword()
+ fmt.Printf("\nDecrypting master key... ")
+ key, err = cryptfs.LoadConfFile(cfname, password)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(ERREXIT_LOADCONF)
+ }
+ fmt.Printf("Success\n")
+ printMasterKey(key)
}
- fmt.Printf("Success\n")
- printMasterKey(key)
if USE_CLUEFS {
cluefsFrontend(key, cipherdir, mountpoint)