Skip to content

Commit

Permalink
protonmail: make SRP modulus signature failures fatal
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BertalanD authored and emersion committed Jul 2, 2020
1 parent 06f6d5b commit fe6f0a6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions protonmail/srp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit fe6f0a6

Please sign in to comment.