From fe6f0a620f3b3b24f0d4626bda2500a931a24b5a Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Tue, 30 Jun 2020 17:21:19 +0200 Subject: [PATCH] protonmail: make SRP modulus signature failures fatal In 93c8007, SRP signature errors were made non-fatal because many users got the following error: openpgp: unsupported feature: public key algorithm 22 This is because Protonmail started signing these messages with an EDDSA key, an algorithm which the Go OpenPGP library does not support. The switch to github.com/protonmail/crypto introduces this algorithm, so messages that haven't been tampered with should pass the verification. --- protonmail/srp.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/protonmail/srp.go b/protonmail/srp.go index aff7673..719a2c0 100644 --- a/protonmail/srp.go +++ b/protonmail/srp.go @@ -8,12 +8,10 @@ import ( "errors" "fmt" "io" - "log" "math/big" "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/clearsign" - openpgperrors "golang.org/x/crypto/openpgp/errors" ) var randReader io.Reader = rand.Reader @@ -45,9 +43,8 @@ func decodeModulus(msg string) ([]byte, error) { } _, err = openpgp.CheckDetachedSignature(modulusKeyring, bytes.NewReader(block.Bytes), block.ArmoredSignature.Body, nil) - if err != nil && err != openpgperrors.ErrUnknownIssuer { - //return nil, fmt.Errorf("failed to decode modulus: %v", err) - log.Println("warning: failed to check SRP modulus signature:", err) + if err != nil { + return nil, fmt.Errorf("failed to check modulus signature: %v", err) } b, err := base64.StdEncoding.DecodeString(string(block.Plaintext))