diff --git a/USAGE.txt b/USAGE.txt index 27c51a4..3e33074 100644 --- a/USAGE.txt +++ b/USAGE.txt @@ -16,6 +16,8 @@ Options: Use OpenSSL instead of built-in Go crypto (default true) -passwd Change password + -plaintextnames + Do not encrypt file names - can only be used together with -init -version Print version and exit -zerokey diff --git a/cryptfs/cryptfs.go b/cryptfs/cryptfs.go index ed19b26..783bfb8 100644 --- a/cryptfs/cryptfs.go +++ b/cryptfs/cryptfs.go @@ -22,7 +22,7 @@ type CryptFS struct { plainBS uint64 cipherBS uint64 // Stores an all-zero block of size cipherBS - allZeroBlock []byte + allZeroBlock []byte plaintextNames bool } @@ -50,11 +50,11 @@ func NewCryptFS(key []byte, useOpenssl bool, plaintextNames bool) *CryptFS { cipherBS := DEFAULT_PLAINBS + NONCE_LEN + AUTH_TAG_LEN return &CryptFS{ - blockCipher: b, - gcm: gcm, - plainBS: DEFAULT_PLAINBS, - cipherBS: uint64(cipherBS), - allZeroBlock: make([]byte, cipherBS), + blockCipher: b, + gcm: gcm, + plainBS: DEFAULT_PLAINBS, + cipherBS: uint64(cipherBS), + allZeroBlock: make([]byte, cipherBS), plaintextNames: plaintextNames, } } diff --git a/main.go b/main.go index 3d9bed7..fef5aba 100644 --- a/main.go +++ b/main.go @@ -58,8 +58,8 @@ func initDir(dirArg string, plaintextNames bool) { } func usageText() { - fmt.Printf("Usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME) - fmt.Printf("\nOptions:\n") + fmt.Fprintf(os.Stderr, "Usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME) + fmt.Fprintf(os.Stderr, "\nOptions:\n") flag.PrintDefaults() } @@ -83,7 +83,8 @@ func main() { flag.BoolVar(&args.passwd, "passwd", false, "Change password") flag.BoolVar(&args.foreground, "f", false, "Stay in the foreground") flag.BoolVar(&args.version, "version", false, "Print version and exit") - flag.BoolVar(&args.plaintextnames, "plaintextnames", false, "Do not encrypt file names") + flag.BoolVar(&args.plaintextnames, "plaintextnames", false, + "Do not encrypt file names - can only be used together with -init") flag.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key") args.cpuprofile = flag.String("cpuprofile", "", "Write cpu profile to specified file")