Klutshnik Key Management System
1. About Klutshnik
Klutshnik is a system which encrypts data-at-rest: backups, files, and archives.
Yawn. Even PGP or Age can do that. Yes, but can they rotate keys without decrypting terabytes of data? Can they share your key across multiple servers so it never exists in one place? Can they guarantee that if your key is stolen today, the thief can't decrypt backups from yesterday (Forward Secrecy) or tomorrow (Post-Compromise Security)?
No.
Klutshnik:
- is free software,
- compartments your keys from your plaintext,
- supports running on small microcontrollers,
- stores absolutely no private data.
1.1. System Roles
In a Klutshnik system, there are 3 roles:
- The Client: You. You have files to protect.
- The Storage: Where you can store large amounts of data cheaply and reliably, such as S3, Dropbox, or a hard drive. This server is untrusted by the client, with the exception that the client trusts the storage server to not corrupt the stored data (integrity) and does not deny service to the client (availability).
- The KM Servers: A group of servers that hold shares of a master secret. They help you calculate decryption keys using a blinded protocol, such that they never see your data, your password, or even the final key.
1.2. The Problem: Data-at-rest vs. Data-in-transit
To understand why Klutshnik exists, we have to look at how we handle secrets differently in messaging vs. storage.
- Data-in-Transit
For data-in-transit (messaging), we have Forward Secrecy (FS) and Post-Compromise Security (PCS). These security properties (PCS & FS) are achieved by generating new ephemeral keys for every message. If a key is stolen, the attacker can decrypt that one message, but they can't decrypt previous messages (FS) and future messages (PCS).
- Data-at-Rest
But how do you actually do that with data that you send to your future self? This is basically what data-at-rest encryption is. Encryption tools like PGP or Age use a static model:
- A random symmetric key used to encrypt the actual data. In Klutshnik, this is called the DEK (Data Encryption Key).
- A long-term asymmetric key which is used to encrypt the DEK. In Klutshnik, this is called the KEK (Key Encryption Key).
The generic flow is:
.
The main issue with this model is that the KEK is static. If someone steals your PGP private key, they can decrypt every file you ever saved (no Forward Secrecy) and every file you save in the future (no Post-Compromise Security) until you manually re-encrypt everything.
1.3. The Solution: Oblivious Key Rotation
In Klutshnik, the KEK is shared among all the KM servers and only used in an Oblivious Pseudo-Random Function (OPRF) as a key to derive the DEK. Using an OPRF allows us to update the KEK without having to decrypt the DEK with the old KEK and re-encrypt with the new KEK. If PGP or AGE were to support this, they would need to decrypt the file and re-encrypt it with the new DEK.
Klutshnik allows you to rotate your KEK without ever downloading or decrypting the data. It provides forward secrecy since old backups cannot be decrypted with today's keys. It also provides post-compromise security since if your device is hacked, you run a meaningful key rotation and the attacker's stolen key becomes useless for future data access.
1.4. Post-quantum and Harvest now, decrypt later
With data-in-transit, an adversary can just store all the encrypted messages and the various other protocol-related data used for key calculation. Adversaries can store it until they have the capability to break the calculation with a powerful attack (like post-quantum computers, but also other so far undiscovered attacks) to be deployed in the future. Since the data-in-transit goes over the internet, anywhere on that path is sufficient for the adversary to harvest.
With data-at-rest, this is quite different. Without access to the KEK, the ciphertext is well protected and probably resistant to any post-quantum attack. Hence, adversaries would be looking for config files like `~/.gnupg` and similar assets to harvest. The threat of harvest-now-decrypt-later and quantum cryptanalysis is much less prevalent, since data-at-rest is not traversing the internet through servers harvested by adversaries. If it is, then it is probably encrypted with an additional layer of (hopefully post-quantum-safe) data-in-transit encryption.
2. Self-hosted and Free Software
Klutshnik is completely open source.
You can host your own server for complete control, or use public servers with confidence knowing they can't access your data. See the server installation guide for more details on how to set up your own server.
Klutshnik code is available on GitHub:
- Reference implementation: https://github.com/stef/klutshnik
- Microcontroller version: https://github.com/stef/klutshnik-zephyr
3. Getting Started
You need a client and access to a few servers.
- Install the
klutshnikClient: Follow the Client Installation Guide. - Find or Host Servers:
4. Acknowledgements
This project was funded through NGI0 Entrust, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.