Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Protonmail fork of golang.org/x/crypto #102

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

BertalanD
Copy link
Contributor

@BertalanD BertalanD commented Jun 27, 2020

The ProtonMail fork of golang.org/x/crypto adds support for for ed25519 (termed State-of-the-art by PM) keys. These changes address the breaking changes to the API. According to ProtonMail/go-crypto#21, there are plans to eventually upstream these, so hopefully we won't have to stick with a fork for long. This library is used by the official bridge, and it is by far the most popular fork and tracks upstream nicely.

Someone who doesn't get openpgp: unsupported feature: public key algorithm 22 when running hydroxide auth should take a look if they get a segfault with the lines below and their corresponding imports uncommented.

https://github.com/BertalanD/hydroxide/blob/287c9b9683e918fd0e8f7cfaf7070ac2d4408cfd/protonmail/srp.go#L27-L31

For the reference, my SRP modulus message was singed by an EDDSA key (ID 0x350585C4E9518F26) and maybe the algorithm has something to do with the segfault.

Fixes #46
Fixes #53

Adds support for ed25519 (termed State-of-the-art by PM) private
keys. SRP modulus signature verification segfaults, so I commented
it out.
@emersion
Copy link
Owner

For the reference, my SRP modulus message was singed by an EDDSA key (ID 0x350585C4E9518F26) and maybe the algorithm has something to do with the segfault.

Hm. Would be nice to dive in the protonmail official bridge codebase and figure out how they check the SRP modulus signature.

@BertalanD
Copy link
Contributor Author

The Protonmail official bridge checks against a hardcoded public key. See:

https://github.com/ProtonMail/proton-bridge/blob/99721b6577fe9079ac7547f11fc77e5090cdd31b/pkg/srp/srp.go#L63-L71

I'm updating this pull request to use that method. Works for me without segfaults.

@emersion emersion mentioned this pull request Jun 30, 2020
Code follows how the official proton-bridge is doing it.
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.
Copy link
Owner

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@emersion emersion merged commit fe6f0a6 into emersion:master Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check SRP modulus signature openpgp unsupported feature
2 participants