]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/verifier.go
Check that verifier is provided for client
[govpn.git] / src / cypherpunks.ru / govpn / verifier.go
index 0dc9388188ad0e1f0c29eec611e7218cae32b687..15955e77a2cf65e35ab18172d638a677170a3200 100644 (file)
@@ -25,6 +25,7 @@ import (
        "fmt"
        "io/ioutil"
        "log"
+       "os"
        "strings"
 
        "github.com/agl/ed25519"
@@ -72,7 +73,7 @@ func (v *Verifier) PasswordApply(password string) *[ed25519.PrivateKeySize]byte
 // Parse either short or long verifier form.
 func VerifierFromString(input string) (*Verifier, error) {
        s := strings.Split(input, "$")
-       if !(len(s) != 4 || len(s) != 5) || s[1] != "argon2d" {
+       if len(s) < 4 || s[1] != "argon2d" {
                return nil, errors.New("Invalid verifier structure")
        }
        var m, t, p int
@@ -125,9 +126,9 @@ func KeyRead(path string) (string, error) {
        var err error
        var pass string
        if path == "" {
-               fmt.Print("Passphrase:")
+               os.Stderr.Write([]byte("Passphrase:"))
                p, err = terminal.ReadPassword(0)
-               fmt.Print("\n")
+               os.Stderr.Write([]byte("\n"))
                pass = string(p)
        } else {
                p, err = ioutil.ReadFile(path)