main: rename parseMasterKey() -> unhexMasterKey()
Make it clear that function does NOT parse the "-masterkey" command line argument, it just unhexes the payload.
This commit is contained in:
parent
c19baa10f8
commit
7622c9f538
2
main.go
2
main.go
|
@ -43,7 +43,7 @@ func loadConfig(args *argContainer) (masterkey []byte, cf *configfile.ConfFile,
|
||||||
// The user has passed the master key on the command line (probably because
|
// The user has passed the master key on the command line (probably because
|
||||||
// he forgot the password).
|
// he forgot the password).
|
||||||
if args.masterkey != "" {
|
if args.masterkey != "" {
|
||||||
masterkey = parseMasterKey(args.masterkey, false)
|
masterkey = unhexMasterKey(args.masterkey, false)
|
||||||
return masterkey, cf, nil
|
return masterkey, cf, nil
|
||||||
}
|
}
|
||||||
pw := readpassword.Once([]string(args.extpass), args.passfile, "")
|
pw := readpassword.Once([]string(args.extpass), args.passfile, "")
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"github.com/rfjakob/gocryptfs/internal/tlog"
|
"github.com/rfjakob/gocryptfs/internal/tlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// parseMasterKey - Parse a hex-encoded master key that was passed on the command line
|
// unhexMasterKey - Convert a hex-encoded master key to binary.
|
||||||
// Calls os.Exit on failure
|
// Calls os.Exit on failure.
|
||||||
func parseMasterKey(masterkey string, fromStdin bool) []byte {
|
func unhexMasterKey(masterkey string, fromStdin bool) []byte {
|
||||||
masterkey = strings.Replace(masterkey, "-", "", -1)
|
masterkey = strings.Replace(masterkey, "-", "", -1)
|
||||||
key, err := hex.DecodeString(masterkey)
|
key, err := hex.DecodeString(masterkey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,7 +48,7 @@ func getMasterKey(args *argContainer) (masterkey []byte, confFile *configfile.Co
|
||||||
}
|
}
|
||||||
// "-masterkey=941a6029-3adc6a1c-..."
|
// "-masterkey=941a6029-3adc6a1c-..."
|
||||||
if args.masterkey != "" {
|
if args.masterkey != "" {
|
||||||
return parseMasterKey(args.masterkey, masterkeyFromStdin), nil
|
return unhexMasterKey(args.masterkey, masterkeyFromStdin), nil
|
||||||
}
|
}
|
||||||
// "-zerokey"
|
// "-zerokey"
|
||||||
if args.zerokey {
|
if args.zerokey {
|
||||||
|
|
Loading…
Reference in New Issue