Demos
Try three parts of capsule in this page.
Nothing here is a mock-up. The dashboard is the page capsule serves, the levels follow the code's own rules, and the cipher is computed in your browser and checked against the answers the Go code gives.
Ten capsules ran on a test host while faults were injected: loops that spin, leaks, crashes, a disk filling. This is what capsule dashboard shows of them. Pick a capsule, change the period, move the pointer over a chart.
On a host the page reads again every five seconds. Here it answers from a recording whose times are moved to now, so it does not advance.
What still holds when a kind of mathematics falls
capsule never rests on one scheme. Choose a key level, then give the attacker what you fear they will have one day. A signature is forged, or a capsule's key opened, only when every wall of that level is down.
The attacker can
None of this helps once a host's own secret is taken from it: whoever holds that is the host. The walls are about what an attacker can do from outside, including with traffic and seals recorded today and a better computer later.
capsule's own cipher, computed here
A small neural network in whole numbers: twelve layers of eight units. Its weights are the key. Fed a counter, it gives 64 bytes of keystream per block. capsule seal -outer lays it over an encrypted capsule's AES-256-GCM. Since 0.15.0 this is version 2: two number systems instead of one, a 512-bit key, a nonce for each archive, and a tag of its own.
Do not protect anything with this. Nobody but its author has tried to break it. In capsule it is only ever a layer over AES-256-GCM, under a separate key, so that it can add a wall and never take one away. This page lets you see it work; it is not a tool for encrypting. If you would like to try breaking it, there is a specification and a challenge.
How it works
- One key becomes two. Every sealed capsule gets a content key of its own, 64 bytes. HKDF-SHA-512 draws two keys out of it under different names: one for AES, one of 512 bits for this cipher. Knowing either tells nothing of the other.
- AES-256-GCM goes first, exactly as without
-outer. What comes out is already ciphertext, and already checked against change. - The key and a nonce become a network. SHAKE-256 stretches them into 892 numbers: the weights and biases of twelve layers of eight units. Nothing is trained and no model is shipped. Another key is another network, and the nonce, new for every archive, makes it another one each time.
- The network is fed a counter, and counts in two ways. Even layers work modulo 264 and bend every sum with
v·(2v+1), a rotation and a shift. Odd layers work modulo the prime 264−59 and bend with the cube. Every layer can be undone; none loses anything. - The input is added back to the last layer, which makes the whole a step that cannot be run backwards even with the key. That gives 64 bytes.
- Those bytes are XORed onto the AES ciphertext, and a tag of 32 bytes over the whole archive, made with the same network, is put at its end. Opening takes this layer off, then AES checks and decrypts as always, then the tag is compared.
Try it
Checking this page's arithmetic against the Go code's known answers…
In capsule the key is drawn from the capsule's content key with HKDF, never typed.
The network on this block
The top row is the input, then one row per layer; one square per unit. Rows marked 2⁶⁴ count modulo 264, rows marked p modulo the prime. A square is filled by how large its number is; the two characters are its highest byte. Pick a square to see its arithmetic.
The 64 bytes it gives
Since the last change
Change the key, the nonce or the block to see how many of the 512 bits turn over. A cipher should turn about half.
How it is built, and what is and is not claimed for it: the README. The specification has everything needed to implement or attack it; the code is outer2.go, and there is a challenge with keystream under keys nobody has.
On a machine of your own
The repository has scripts that make their own capsules in a temporary folder, show each step as it happens, and remove everything when they end. They need a Linux host with capsule installed and busybox.