Live data from Hacker News

Encrypting Data in the Browser Using WebAuthn

blog.millerti.me

1–10 of 23 posts

Re: Encrypting Data in the Browser Using WebAuthn

#2
That is really cool, thanks for a detailed writeup. I try to pay attention to the WebAuthn spec and did not realize this was possible.

I suspect that for most people, WebAuthn (esp with synced passkeys) is going to actually make the CI part of CIA possible for end user content on the internet. In practice it solves the UX around key management and device syncing issues - it passes the "your grandmother can use it" test IMO.

The web3 concept was caught up in cryptocurrencies and constraints around distributed systems; but extending asymmetric cryptography to end users is what should be worked on, as it allows improving most systems without financial or performance overhead. mTLS certs approached the issue but the UX never got there, and cannot be used outside of site authentication.

Re: Encrypting Data in the Browser Using WebAuthn

#3

That is really cool, thanks for a detailed writeup. I try to pay attention to the WebAuthn spec and did not realize this was possible. I suspect that for most people, WebAuthn (esp with synced passkeys) is going to actually make the CI part of CIA possible for end user content on the internet. In practice it solves the UX around key management and device syncing issues - it passes the "your grandmother can use it" te…

> it passes the "your grandmother can use it" test IMO.

Indeed, but note that having the token is still rare. It'd be good if browsers exposed TPMs via WebAuth since they're more common on consumer-grade hardware.

And also the "minor" thing that having only one strong authenticator makes it super-easy to lose own data just in case the authenticator breaks etc.

Re: Encrypting Data in the Browser Using WebAuthn

#4
Am I misunderstanding TFA or is the encryption done with the encryption key in the clear inside the browser?

I just set up my servers' SSH to use U2F keys for authentication and the secret never leaves the security key, protected behind the security key's HSM.

That's kinda the point of these security keys: computers aren't devices to be trusted. If they were, we wouldn't need physical security keys with the secrets hidden behind a HSM.

From TFA:

> Local threats like JavaScript injection attacks could exfiltrate the value of inputKeyMaterial from Step 2.1 and store it away for later use.

I really enjoyed TFA but... These kind of "local threats" are precisely what these U2F security keys are all about: you can use them on a totally compromised computer and yet the attacker cannot extract the secret from the security key.

I've seen people use security keys with GPG and I'm nearly sure the private part of the key is never leaving the security key.

I may be wrong though...

Re: Encrypting Data in the Browser Using WebAuthn

#5
this is excellent news.

Combined with passphrases, it makes encrypted web apps possible without the need to remember a password, which is the main risk in applications where the data is encrypted.

Last time I checked PRF was in the source code of Chrome, but not available in the official release, but seems like it's going to come. I hope Safari will follow soon.

Re: Encrypting Data in the Browser Using WebAuthn

#6

That is really cool, thanks for a detailed writeup. I try to pay attention to the WebAuthn spec and did not realize this was possible. I suspect that for most people, WebAuthn (esp with synced passkeys) is going to actually make the CI part of CIA possible for end user content on the internet. In practice it solves the UX around key management and device syncing issues - it passes the "your grandmother can use it" te…

> it passes the "your grandmother can use it" test IMO. Indeed, but note that having the token is still rare. It'd be good if browsers exposed TPMs via WebAuth since they're more common on consumer-grade hardware. And also the "minor" thing that having only one strong authenticator makes it super-easy to lose own data just in case the authenticator breaks etc.

They do. At least Apple implements WebAuthn for Touch ID and Face ID on both its mobile and laptop platforms, using Safari.

Re: Encrypting Data in the Browser Using WebAuthn

#7

That is really cool, thanks for a detailed writeup. I try to pay attention to the WebAuthn spec and did not realize this was possible. I suspect that for most people, WebAuthn (esp with synced passkeys) is going to actually make the CI part of CIA possible for end user content on the internet. In practice it solves the UX around key management and device syncing issues - it passes the "your grandmother can use it" te…

> it passes the "your grandmother can use it" test IMO. Indeed, but note that having the token is still rare. It'd be good if browsers exposed TPMs via WebAuth since they're more common on consumer-grade hardware. And also the "minor" thing that having only one strong authenticator makes it super-easy to lose own data just in case the authenticator breaks etc.

[deleted]

Re: Encrypting Data in the Browser Using WebAuthn

#8

Earlier quoted context omitted.

> it passes the "your grandmother can use it" test IMO. Indeed, but note that having the token is still rare. It'd be good if browsers exposed TPMs via WebAuth since they're more common on consumer-grade hardware. And also the "minor" thing that having only one strong authenticator makes it super-easy to lose own data just in case the authenticator breaks etc.

They do. At least Apple implements WebAuthn for Touch ID and Face ID on both its mobile and laptop platforms, using Safari.

Windows also has this; they call it "Windows Hello".

Re: Encrypting Data in the Browser Using WebAuthn

#9

Am I misunderstanding TFA or is the encryption done with the encryption key in the clear inside the browser? I just set up my servers' SSH to use U2F keys for authentication and the secret never leaves the security key, protected behind the security key's HSM. That's kinda the point of these security keys: computers aren't devices to be trusted. If they were, we wouldn't need physical security keys with the secrets h…

> Am I misunderstanding TFA or is the encryption done with the encryption key in the clear inside the browser?

I'm struggling with a similar problem, and don't see a more user-friendly way to do it.

So far my flow is as follows:

1. User logs in and is prompted to create an encryption key using a password that they won't forget 2. Encryption key is created and wrapped using the password as part of the key material for the wrapping key 3. Wrapped encryption key is sent off to the DBMS. 4. Wrapped encryption key is fetched from DBMS and user is prompted for password to unwrap 5. Unwrapped encryption key is stored locally in order to encrypt and decrypt messages.

I don't see any way to do it differently without either a) storing the unwrapping key password (in which case, why not store the key itself?), or b) asking for the unwrapping key password every time the key is used (which is super annoying).

Assuming that I can't ask users to do any kind of key management themselves, is there a better option?

Re: Encrypting Data in the Browser Using WebAuthn

#10
This is cool, but the elephant in the room for all these cryptography in the local browser is still there. Namely, you have to trust the server not to send you malicious html and if you already trust the server you might as well do things server side. As the saying goes, security is always about the weakest link.
Post reply on HN