How it works: Keys

How it works

Keys

Each key Cesar uses, what it opens and the algorithms behind it. For the idea in plain words, start with How encryption works.

Overview

Everything Cesar stores for you is sealed on your computer, with keys the server never has. There are five of them, and each opens the next: your passphrase is the first, a conversation is at the end.

Sealed means encrypted so that only the right key opens it.

Only on your computersOn Cesar's server, sealedYour passphraseknown to you alonecannot be reset1Argon2idMaster keykept in the system keychainnever leaves the computer2opensYour account's private keysealed under the master keyonce open: your account keyYour account keyone keypair per accountthe server has the public half3opensThe workspace's private keysealed with each member's account keyonce open: the workspace's keyTeammates seal things to youwith the public half.A workspace's keyone keypair per workspacemade on its owner's computer4opensThe conversation's keysealed with the workspace's keyonce open: the conversation's keyEach member gets it sealedto their own account key.A conversation's keyrandom, one per conversationseals its text and its details5opensThe conversationtext, title, folder, agentMoving a conversation to aworkspace seals this key again.
Each key on the left opens the sealed thing on its right, which holds the next key down. The server holds the right-hand column, and nothing that opens it.
  1. Your passphrase makes the master key. Through Argon2id, a function made slow on purpose so that guessing passphrases is expensive. Neither of the two ever reaches the server.
  2. The master key opens your account key. The server keeps the private half of your account key, sealed under the master key. That is how a new computer gets it: sign in, type the passphrase, open it.
  3. Your account key opens your workspaces. Each workspace has a key of its own. Its private half is sealed once for each member, with that member's account key.
  4. A workspace's key opens its conversations. Each conversation has a random key, sealed with the key of the workspace it is in.
  5. A conversation's key opens the conversation. The text, the title, the folder and the name of the agent are sealed together under it.

Your passphrase

The master key is 32 bytes made from your passphrase and a random salt by Argon2id (64 MiB of memory, 3 passes). It is kept in your system's keychain and never leaves the computer.

Everything else depends on it, so the passphrase cannot be reset. Without it, nothing above can be opened, by you or by us.

Signing in with GitHub does not replace it. GitHub says who you are, so the server knows which sealed files to hand you. The passphrase is what opens them.

Sharing

Sharing is sealing a key one more time. Moving a conversation into a workspace seals its key with the workspace's key. Letting someone into a workspace seals a copy of the workspace's key for them.

Both happen on a computer that already holds the key in question. The server cannot do either, so it cannot let itself in.

Removing someone from a workspace changes its key, so what is moved in afterwards is sealed with a key they never had. It cannot take back the copies already on their computers.

Check a teammate's fingerprint

The server hands out everyone's public keys, so it could try to hand out one of its own in place of a teammate's. A fingerprint is a short name for a key that two people can compare.

cesar workspace approve prints the other person's fingerprint, and they see their own with cesar status. If the two match, the key is theirs. Cesar remembers it and refuses if it ever changes.

The signing key

A second key signs what you write for your team. It is derived from your master key, so it is the same on all your computers, and the server holds only its public half.

Every block you push to a team's brain is signed with it. Each member's computer checks who wrote a block before it trusts a line of it. See Rules and roles.

Algorithms

ForAlgorithm
Passphrase to master keyArgon2id, 64 MiB, 3 passes, random salt
Sealing conversations and blocksXChaCha20-Poly1305, one random key each
Signing blocksEd25519

Where the keys are on your computer

  • The master key is in the system keychain. With CESAR_KEYSTORE=file, or on a computer with no keychain, it is in ~/.cesar/key, readable by you only.
  • ~/.cesar/config.json holds your login and your account's keys, which are public or sealed.
  • cesar logout removes the login and the key from the computer.