X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-cfgenc%2Fmain.go;h=d2a1483d9ebd3595e4fb237ebe1eb9f1b151649e;hb=7c507e7ddba9fe5557df06c860fe9fa6197ba2e1;hp=cce42dac950e890b7789c4521840422cd397fdfe;hpb=128618d02d84d08164060f14e7fdd3b87e491fcb;p=nncp.git diff --git a/src/cmd/nncp-cfgenc/main.go b/src/cmd/nncp-cfgenc/main.go index cce42da..d2a1483 100644 --- a/src/cmd/nncp-cfgenc/main.go +++ b/src/cmd/nncp-cfgenc/main.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2022 Sergey Matveev +Copyright (C) 2016-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "log" "os" @@ -34,8 +33,7 @@ import ( ) func usage() { - fmt.Fprintf(os.Stderr, nncp.UsageHeader()) - fmt.Fprintf(os.Stderr, "nncp-cfgenc -- encrypt/decrypt configuration file\n\n") + fmt.Fprint(os.Stderr, "nncp-cfgenc -- encrypt/decrypt configuration file\n\n") fmt.Fprintf(os.Stderr, "Usage: %s [options] cfg.hjson > cfg.hjson.eblob\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s [options] -d cfg.hjson.eblob > cfg.hjson\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s [options] -dump cfg.hjson.eblob\n", os.Args[0]) @@ -70,7 +68,7 @@ func main() { os.Exit(1) } - data, err := ioutil.ReadFile(flag.Arg(0)) + data, err := os.ReadFile(flag.Arg(0)) if err != nil { log.Fatalln("Can not read data:", err) } @@ -115,7 +113,7 @@ func main() { log.Fatalln(err) } os.Stderr.WriteString("\n") - if bytes.Compare(password1, password2) != 0 { + if !bytes.Equal(password1, password2) { log.Fatalln(errors.New("Passphrases do not match")) } eblob, err := nncp.NewEBlob(*sOpt, *tOpt, *pOpt, password1, data)