Hacker News new | comments | show | ask | jobs | submit login
OpenPGPjs v3.0 (protonmail.com)
199 points by vabmit 5 months ago | hide | past | web | favorite | 44 comments



In case anyone that doesn't follow the development of the library closely missed it, the main improvement in this version is the introduction of ECC support. ECC tends to be able to provide equivalent levels of security as traditional "big prime" cryptography (like RSA) with less computationally intensive operations. This is especially important in a library like OpenPGPjs that is primarily meant for in browser based web usage because it should make things, like sending and receiving mail, faster when ECC is used over older PGP public key encryption systems. For people that use ProtonMail's web based crypto on mobile or tablet devices, a switch to ECC would result not just in similar performance improvements but also in lower battery usage.

Currently, ProtonMail uses RSA keys, but this addition of ECC support to their web encryption library may mean that they are about to start switching users to ECC keys. Because using "larger" (when compared with equivalent theoretical strength RSA keys, for example) ECC keys is less resource intensive than using higher security keys in some other forms of cryptosystems (like RSA) it may also be an indication that ProtonMail is preparing to upgrade users to higher security/stronger keys.

Many cryptographers and organizations, including the US Government, have recommended for a long time that people migrate from older "big prime cryptography" based cryptosystems to ECC based cryptosystems for increased security.


>Many cryptographers and organizations, including the US Government, have recommended for a long time that people migrate from older "big prime cryptography" based cryptosystems to ECC based cryptosystems for increased security.

Not what I've heard.

https://threatpost.com/nsas-divorce-from-ecc-causing-crypto-...


> Many cryptographers and organizations, including the US Government, have recommended for a long time that people migrate from older "big prime cryptography" based cryptosystems to ECC based cryptosystems for increased security.

Personally I'd stay away from NIST recommended curves for long term keys (as used in OpenPGP). Ed25519 looks nice and there is experimental support for it in gnupg but it's not post quantum unfortunately.


> Ed25519 looks nice and there is experimental support for it in gnupg but it's not post quantum unfortunately.

That's not a problem of NIST recommendations. There aren't any post-quantum secure elliptic curve public-key systems. The fundamental computational problem used by ECC public-key cryptography isn't post-quantum secure, so it's not really a matter of curve choice.


The problem with NIST curves (vs ed25519) is the choice of parameters (it is not clear why they have such and such values) and the implementation edge cases. You already know it but maybe someone else will find it interesting: https://safecurves.cr.yp.to/

The comment about post quantum crypto did not relate to ECC directly. I just would like to see some PQ crypto in OpenPGP :)


> In case anyone that doesn't follow the development of the library closely missed it, the main improvement in this version is the introduction of ECC support.

Wow...I'm sort of shocked that wasn't a v1.0 consideration.

> ECC tends to be able to provide equivalent levels of security as traditional "big prime" cryptography (like RSA) with less computationally intensive operations. This is especially important in a library like OpenPGPjs that is primarily meant for in browser based web usage because it should make things, like sending and receiving mail, faster when ECC is used over older PGP public key encryption systems. For people that use ProtonMail's web based crypto on mobile or tablet devices, a switch to ECC would result not just in similar performance improvements but also in lower battery usage.

In particular, elliptic curves have smaller parameters, which allow for smaller keys at the same bit security level. For example, to achieve 128-bit security, an RSA/DLP modulus must be 3072 bits. Elliptic curves achieve the same security level with only 256-bit parameters. They are also faster for most operations, but RSA is still technically faster for signature verification.

> Many cryptographers and organizations, including the US Government, have recommended for a long time that people migrate from older "big prime cryptography" based cryptosystems to ECC based cryptosystems for increased security.

True, but elliptic curve cryptography is just as vulnerable to quantum computers, however long off that problem may be.


> Wow...I'm sort of shocked that wasn't a v1.0 consideration.

Given that you need to pass --expert to gpg 2.1 as of right now to even generate an ECC keypair for PGP use (nor use one on an OpenPGP smartcard or yubikey), I can sort of forgive the lack of ECC in 1.0. I don't think it sees wide usage for PGP keys (some clients don't support it, also).

However, as of the last time I tried Protonmail (about 10 minutes ago to check this is all still true) you can't: revoke/reissue your PGP key, validate outside signatures (either on encrypted messages or signed, plaintext messages) or send pure-PGP mail to users outside of protonmail (there's an encrypt for non-protonmail users option, that sends a link instead). Essentially as another commenter has said, you can't really do PGP with ProtonMail.


I don't use ProtoMail but it sounds like they are "managing" users' private keys!? Am I understanding this correctly? ProtonMail has access to their users' private keys? And they are using web-based encryption, delivered via JavaScript?

And people trust them!?


This is about to change dramatically.


> Wow...I'm sort of shocked that wasn't a v1.0 consideration.

My company contributed the ECC support for enabling messaging using the same keys as Bitcoin and other cryptocurrencies. See https://news.ycombinator.com/item?id=16548015


Aren't there multiple operating quantum computers right now? Isn't this a very imminent problem?


Yes and no. To simplify matters, you need not just a quantum computer but such a machine with the right sort of qubits. The right sort of qubits being logical qubits, not physical, many of which are needed for error correction.

It's not clear whether we can currently create a machine with sufficient logical qubits to run Shor's algorithm in a meaningful way.

However, out of an abundance of caution, we're "starting" now (some designs have existed for longer but this (NIST PQC) is the first competition, which focuses minds) so as to have something ready when/if a quantum computer becomes a reality.


^^^this

A DARPA researcher explained to me that a quantum computer's qbits would have to be 99.9999999999% error-free (that's 12 nines) in order to perform the necessary steps of Shor's quantum factorization algorithm. Current state of the art qbits are 99.9-99.99% error-free. Basically, we have a long way to go.


Depends what qualifies as a quantum computer. It is questionable whether current 'quantum computers' deserve the name.


What is the threat model for PGP in JS? Like, is there an Alice, Bob, Carol, Eve story under which PGP in JS makes sense?

The canonical example that IMO doesn't make sense is when Alice and Bob want to communicate privately using Eve as an webmail provider who wants to snoop in on the communications. Alice and Bob can't just trust Eve to provide a copy of OpenPGPjs in a <script> tag on EveMail.com, because then they're trusting Eve to provide a legitimate PGP implementation, trusting Eve not to log their keystrokes in JS, etc.

I can understand OpenPGPjs as a server-side library in Node (though I suspect it would be safer to run a battle-hardened library like GPG with node FFI).

But, in client-side web code, how could this ever make sense?


One user story is that Alice uses Eve's webmail, and Bob uses PGP and mutt on his laptop. Before Eve's webmail supported PGP in JS, Bob had to send his emails to Alice unencrypted (and unsigned), which meant his mail provider could read the plaintext (even if he trusted that mail provider to always require a TLS connection when sending to Eve's servers).

From Alice's point of view, she is just using webmail as she always has, except now she has the assurance that no one (other than Eve) can spoof Bob's identity, and that Bob's mail server isn't reading the messages she sends him (unless Eve is deliberately leaking the plaintext somehow despite sending Bob the encrypted version).

Long term it would be nice if the W3C's SRI standard was extended to allow offline signing of JavaScript files:

https://github.com/w3c/webappsec/issues/449

and for browsers to prompt you whether you wanted to run a new (offline signed, maybe independently audited) version of those files.


> [Alice knows] no one (other than Eve) can spoof Bob's identity

If Carol or Chuck can spoof Eves "identity" they can spoof Bobs identity. This can be done in a multitude of technical or social ways.

Is it better to have this than nothing? The problem is that you have to trust your whole infrastructure if you want to do this kind of client side encrypting.


If your threat model says that Eve's webmail servers can be spoofed, then Alice can't use webmail at all, or possibly any websites. At that point, the security of PGP in JS is pretty much irrelevant.


I think that is one of the most obvious things that can happen, but no it only affects JS PGP that is integrated on a site you use. PGP in JS is still relevant because it makes it easier to download, verify and execute Javascript "anywhere", not as an integrated solution served by a third party. Sadly.


I've been looking for gmail alternatives and this is my conclusion. Protonmail plays the part of the secure and private email provider, but, technologically, can't provide that. The only concrete thing their users have going is the superior legal environment of Switzerland. A less-than-concrete comforter is that if we believe that the people behind Protonmail believe in privacy, we'll tend to think they're more likely to try to protect ours if push comes to shove. This makes me look for alternatives.


So, that's a conclusion but no reasoning behind it, therefore it's impossible to evaluate critically.


Apparently you missed the reasoning. ProtonMail has the capability to access either the plaintext and/or private keys.

(FYI: It is customary here on HN to disclose any affiliations when commenting.)


One could have PGPjs in a webextensions in the browser and use it to encrypt/decrypt/sign/verify contents in forms.

One would of course still need a protection against key logging etc. (eventually the web extension has relevant matter only in a pop-up?)


Subresource integrity means you could trust Eve in some cases. Also if Eve provides a script tag from a trusted CDN it could work. You would have to check it every time though.

What might help is a browser extension that tracks changes and allows you to “lock” into a version of a website.


Technically Sri only reduces the amount of trusted data you need to keep around; you'd need an index.html that loads gpg.js and a js client that talks to a server (eg: jmap or a bespoke jsonapi that allows getting/sending mail).

This is pretty much what browser extensions do; bottle up some hypertext resources, signed and versioned.

You still have three obvious threats: local superuser can read application memory etc; your local user can read your memory and any browser compromise/bug can likely read your browser/session data.

The real question is if the browser sandbox is ever likely to be good enough that you don't have to worry about a font file from a compromised website about kittens reading your email in another tab.


I wish something like this would take off -

https://github.com/kylehuff/webpg-chrome

We deserve a better userspace from our browsers. The excuse that "users" don't want this because its "hard" is circular.


The project looks really cool! But...the fact that the website has a certificate error doesn't inspire much confidence. Especially since it's a security tool. :(


What certificate error? Neither https://openpgpjs.org nor the link here have a certificate error for me. Maybe you are being MITMed...


I got a certificate error as well. This site hasn't had its certification for 132 days. I thought the whole link was a super meta joke/test. It does look cool though. Thanks for posting.


I'm also getting it. The certificate for https://webpg.org/ expired October 29, 2017.


Aha, I misunderstood the original comment.


Expired certificate is probably the least egregious security error, especially for a homepage.

No data is lost or stolen. Customers won't like it, you may lose sales, etc, but your data security is fine.


It's a sign of either laziness, incompetence, or lost interest, and none of those things are good.


Not to say that an expired cert isn't bad of course :)


Great to see protonmail working on this.

It's shocking how much sensitive data is sent by mail (contracts, passwords, lawyers, etc..) without pgp signing / encryption on a daily basis.


Why not use webcrypto instead?


They are probably using it underneath. Webcrypto by itself is just a set of primitives, you need a higher level abstractions to do anything useful in real world.


I don't get it. Protonmail still doesn't support PGP, yet they're working on open source libraries for other people to implement PGP? I don't understand these priorities.


The library is the prerequisite for proper PGP support in ProtonMail, so it obviously needs to be built first.


You mean the library that you've been using from the beginning of the proper web client? This is not an answer. Kudos for finally doing ECC though.


For internal use we had all RSA keys so it was fine. For external use we have to support what everyone uses, and there is a variety as you know. Saying "hey, you can use PGP but all your friends have to have RSA keys" is not a recipe for a good user experience.


This is great to hear! If/when protonmail transitions to be mail host that support open standards in a wider sense, I'd more seriously consider becoming a customer :-)

Fwiw, while I'm not that interested in the current project - I actually think it's great to build a walled garden on open standards - especially for secure services. Makes it easier to evaluate, and opens the door fore secure interop in the future.


What do you mean "ProtonMail still doesn't support PGP"? You mean sending PGP encrypted e-mails to non-protonmail addresses?


Yeah, ProtonMail's really a closed garden unfortunately.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: