This document covers the internal protocol and cryptographic details of KeePassRPC CLI.
KeePassRPC uses a two-stage authentication process:
- Client sends SRP
identifyToServerwith a random username and public ephemeralA - Server responds with salt
sand public ephemeralB - Client computes SRP proof
Mand sendsproofToServer - Server verifies
Mand sends proofM2 - Both sides derive session key
K = SHA-256(S)whereSis the SRP shared secret - Client saves the session key locally
After the initial SRP handshake, the client reconnects and uses the stored session key:
- Client sends stored username
- Server sends a random challenge
sc - Client generates a random challenge
ccand computes responsecr = SHA-256("1" + key + sc + cc) - Server verifies
crand sends its responsesr = SHA-256("0" + key + sc + cc) - Client verifies
sr
All subsequent communication uses encrypted JSON-RPC:
- Algorithm: AES-256-CBC
- HMAC: SHA-1
- Key: Session key derived from SRP (
K = SHA-256(S)) - IV: Random 16 bytes per message
- Prime (N): 512-bit safe prime
- Generator (g): 2
- Key derivation constant (k):
0xb7867f1299da8cc24ab93e08986ebc4d6a478ad0 - Hash function: SHA-256
All messages are JSON with the following envelope:
{
"protocol": "setup|jsonrpc",
"srp": { ... },
"key": { ... },
"error": { ... },
"jsonrpc": { ... },
"version": 131072
}- The WebSocket connection is unencrypted (runs over localhost only)
- Session keys are stored locally in
keepassrpc-cli.authand should be protected - The connection password is randomly generated by KeePass and displayed in a pop-up during SRP negotiation