Encrypting files with passkeys and age
56 comments
·July 14, 2025wkat4242
faeranne
Checkout passage: https://github.com/FiloSottile/passage which has done part of this by using age instead of pgp. I used it for a while, and last I checked there was sadly no android app (the pass android app hardcoded too much PGP to be a useful base, so I was told), but the work is def there.
wkat4242
> Checkout passage: https://github.com/FiloSottile/passage which has done part of this by using age instead of pgp.
Nice! But I can't really use it until it works on Android too (with hardware keys). I'll definitely try it out though.
> the pass android app hardcoded too much PGP to be a useful base
The original one did not. It leveraged the OpenKeyChain external app which basically handles all the PGP stuff. So there was no PGP code in the app. Similar to how it's done on a PC with the gpg suite
But someone rewrote it with an internal library which also removed Yubikey support.
VTimofeenko
Android pass+[yubi|nitro]key work fine through openkeychain:
megous
I think my dream password manager currently is a Pinephone with a special custom UI that allows for managing and securing a list of accounts/passwords that can type them out via USB HID keyboard gadget when prompted.
No way to prompt it for data, or compromise it remotely.
No other features, no OS userspace, no wifi, no adb, no nothing. Just a Linux kernel + a tiny single userspace static binary based on lvgl for UI and libsodium for encryption/storage. Normally powered off, boots in 2 seconds. :)
bkettle
I made one of these a while ago in school, it was fun! I think it's a great idea. Mine really had nothing: an overly complicated MCU, since it was provided by the class, but otherwise no need for an OS or anything: https://benkettle.xyz/projects/password-keeper/
megous
Nice. My wishlist also includes something similar looking with Luckfox Pico Mini + small OLED for displaying info about requests (via USB), to authorize various crypto operations with secret material stored on the device. :)
lxgr
Tons of ways to compromise it between your computer's USB port and the server's database, though. If you already have dedicated hardware, FIDO authenticators make much more sense.
> Just a Linux kernel [...]
That's several orders of magnitude more lines of code than any FIDO authenticator implementation.
> Normally powered off, boots in 2 seconds. :)
Yubikeys boot even faster!
wkat4242
Yeah and also it's huge for just a password manager.
odo1242
> Tons of ways to compromise it between your computer's USB port and the server's database, though. If you already have dedicated hardware, FIDO authenticators make much more sense.
I mean, if you have the amount of access needed to compromise a USB connection, you have way more than enough access than needed to just yoink the authentication token or encryption key from browser storage.
megous
None of this is a problem.
FIDO2 works only with websites that support it.
Imustaskforhelp
I do think though that just using a pinephone as just a password manager might make sense for some people (I think) but at the price of pinephone and the features you can get with it, this is really underselling it (I think)
Maybe I don't have enough money to buy a pinephone just for this purpose but even if I would have, I would personally look more into soldering (esp32?) or some single board chip (SOC?) with a touch screen sounds nice too.
Now I am not kidding, there was this dumb phone which I was using and its cost was like 12.5$ and it had the features of camera, mic , text , messaging, audio, file manager and so much more... Basically it just didn't had a browser or ability to add apps ofc since it wasn't android. But yeah I do believe that something niche could be developed for people like you at maybe 1/10th the price
bee_rider
Why a phone, though? The device doesn’t need any connectivity other than to act as a USB “keyboard,” right? Maybe a raspberry pi zero could do it.
megous
Cheaper, with integrated display, battery, touchscreen, working software, and nice form factor for the use case, sane fully open bootloader and firmware, full documentation for everything, much more power efficient.
Leo-thorne
This is a pretty cool idea. Using passkeys to encrypt files means you don’t have to remember passwords but still keep things secure. What I really like is that each file gets its own key, so even if one gets exposed, the others stay safe. If this kind of setup gets integrated into tools we use every day, like photo apps or cloud storage, it could be really useful.
defraudbah
I follow Filippo for years and he's doing amazing job for crypto and golang communities. Excited to see your bikes adventures too. If it wasn't for you who knows, maybe golang wasn't that popular in the fields where cryptography matters.
keep up, Filippo!
dariosalvi78
I was waiting for the prf to be implemented since a long time exactly for this type of applications (e2e encryption), but , as usual, Safari doesn't support it
https://developer.mozilla.org/en-US/docs/Web/API/Web_Authent...
FiloSottile
Huh, iCloud Keychain supports the prf extension when used with Chrome, so I had assumed they added support to Safari as well, but I just tested it and sure enough, you're right.
Edit: well https://webauthn-passkeys-prf-demo.explore.corbado.com/ works with an iCloud Keychain passkey on Safari on macOS 15.5, but Typage doesn't work with a YubiKey 5, so there is some support (the MDN data is out of date) but also something weird.
lxgr
I'm pretty sure Safari supports it since iOS 18! See for example https://www.corbado.com/blog/ios-18-passkeys-automatic-passk... and https://www.corbado.com/blog/passkeys-prf-webauthn.
randomint64
WebAuthn may be one of the most important security technology of the decade. It's a revolution in key management, which may be the hardest part of applied cryptography.
Passkeys enable phishing-resistant and 1-click authentication.
The PRF extension discussed here enables end-to-end encryption of data (with envelope encryption). Think about secure chat backups, double factor disk encryption (password + security key) and much more.
Soon we will be able to sign apps bundle (APKs, IPAs) with hardware security keys.
Great times are ahead for those who care about securing their users' data.
thadt
> Note that there’s no secure way to do asymmetric encryption: we could use the PRF extension to encrypt a private key, but then an attacker that observes that private key once can decrypt anything encrypted to its public key in the future, without needing access to the credential.
IMHO, it would move the world of privacy forward significantly if someone took up championing a web API that securely pipes the output of WebAuthn's PRF into the input seed of a WebCrypto ML-KEM/X25519 implementation.
Sure, we'll still have the (unenviable) job of securing the client side JS environment, but it would make it feasible to have E2EE in the browser with passkey managed private keys exposed only up to the point of the browser/OS.
neutrinoq
For a simple web app that encrypts files with passkeys, check out https://filekey.app
crossroadsguy
On this topic — how to harden security of the keychain db on the Mac? One is — keep the Mac password long and difficult to crack. What else? Is there any other way to make it harder? Like is there a way to ensure that those db files can’t be accessed even with the mac password on any other hardware?
Also — on a mac why are these files not saved in a location that requires elevated access?
Because that file has everything — password, wifi keys, passkeys; and it is not very practical to have 8-10 word long passphrases for your daily computer.
Basically — I am thinking about the scenario when the data of passwords/keychain db might be compromised but not the Mac password itself.
Crontab
I recently started to plan for off-site, cloud-based storage and I have pretty much decided that I will be using Age to encrypt my backup files. It basically does everything I need.
My appreciation to the creator.
mkw5053
Very cool! Clever use of WebAuthn’s PRF to reuse synced passkeys for file encryption without the hassle of managing private keys directly. The catch is credential revocation: leaked passkeys mean full rotation and bulk re-encryption of files. That works fine for casual backups, but production usage will need tooling to handle automated rotation cleanly.
lxgr
> Clever use of WebAuthn’s PRF to reuse synced passkeys for file encryption
Agreed on the clever part, but arguably that's exactly what PRF was designed for :)
> The catch is credential revocation: leaked passkeys mean full rotation and bulk re-encryption of files.
That's where the PRF input of key derivation comes in. The idea is to have that input be rotate-able.
That's also why there is two of them: So you can "atomically" (or at least using only one WebAuthN interaction) rotate the derived keys.
packetlost
I feel like only one extra layer of indirection (encrypt a symmetric key with the age key) would enable rotation.
9dev
Yeah, envelope encryption is the only sane solution. That also allows decryption with multiple passkeys, for example.
defraudbah
could you please elaborate on envelope encryption in this case. I encrypt one key with another, how does it enable rotation?
The first key is now safer, but now I have to manage 2 keys, master key and a the one I use per files group X.
johnisgood
Can someone sum up the difference between "passkeys" and "SRP, PAKE (like OPAQUE), and ZKPs"?
Besides being related to the web (only?), it seems.
I wonder if this can replace the PGP backend from "pass": https://www.passwordstore.org/
I don't really want to replace it. It works fine. But the toolchain for other platforms is becoming difficult to manage. I use pass with PGP Yubikeys as backing for each encrypted password. But the developer of the Android version has stopped supporting it and the person who took it over has removed yubikey support because he doesn't use it himself and doesn't care about it.
Of course I need to access my passwords on Linux, Windows, Mac, Android. Only iOS is not possible because Apple doesn't allow raw APDU access to NFC tags so you can't do OpenPGP functions.
I also don't want to use a password manager with a single master password like bitwarden. I want each password to be encrypted individually with the public key from a number of hardware tags (multiple, that's also a hard requirement). This way not my whole password database is instantly leaked when my master password gets compromised. Even when my endpoint gets completely compromised, the only passwords they will have are the ones I decrypted on it since it was compromised. Yubikeys require a physical touch for every decryption so you also can't 'milk' them for credentials when they're inserted and unlocked. Also, any password manager I use must be self-hosted, I hate and don't trust the big tech companies.
I wonder if this could be a new backend. And have support on all platforms (though iOS I don't care about personally, but it would be a nice to have).