# BSI TR-02102-1 Mapping

How the cryptography aquaman implements itself compares with **BSI TR-02102-1**, "Cryptographic Mechanisms: Recommendations and Key Lengths", **Version 2026-01** (23 January 2026), the technical guideline of the German Federal Office for Information Security.

This is a self-assessment by the project, not a certification, and BSI has not reviewed it.

## Scope

aquaman keeps credentials in the vault you choose, and for seven of the eight backends the cryptography is that vault's own (Keychain, 1Password, Bitwarden, HashiCorp Vault, KeePassXC, Keeper, systemd-creds). This page covers what aquaman's own code does:

- the `encrypted-file` backend, where the vault is a file aquaman encrypts under a password;
- the two local tokens: the loopback token agent hosts present, and the route token a program routed through the proxy presents;
- the hash that chains the audit log.

## Parameters

| Parameter | TR-02102-1 (2026-01) | What aquaman does | Test |
|---|---|---|---|
| **Block cipher** | Section 3.1, Table 3.1: AES-128, AES-192 or AES-256 | AES-256 | [`tr-02102-1-crypto.test.ts`](https://github.com/tech4242/aquaman/blob/v0.19.0/test/compliance/bsi/tr-02102-1-crypto.test.ts) |
| **Mode of operation** | Section 3.1.1: GCM is among the recommended modes | GCM, with the vault file's contents authenticated as a whole | same |
| **GCM nonce length** | Section 3.1.2: 96 bits recommended | 96 bits | same |
| **GCM nonce uniqueness** | Section 3.1.2: the probability that a nonce repeats under one key should be at most 2^-32 | Every write draws a new random nonce and a new random salt, so every write also uses a new key; a nonce cannot repeat under one key | same |
| **GCM tag length** | Section 3.1.2: at least 96 bits for general use | 128 bits written; on read any other length is refused before the key is derived | same (one row per tag length) |
| **Password-based key derivation** | Section B.1.2: a keyed MAC on a hardware element where one is available; otherwise Argon2id | PBKDF2-HMAC-SHA256, 600,000 iterations, a 128-bit random salt, a 256-bit key. **Differs from the recommendation**, see below | same (asserts the parameters in use, not conformance) |
| **Password strength** | Section 6.3.1: where a secret is derived directly from a password, choose it by a method that gives at least 120 bits of entropy | A minimum of 12 characters is enforced. **Differs from the recommendation**, see below | none |
| **Random values for tokens** | Section 8: random numbers from a suitable generator; the guideline's security level is 120 bits | The loopback and route tokens are 192 bits each from the operating system's generator (`crypto.randomBytes`); the route token is new at every daemon start | same |
| **Token comparison** | No parameter; side-channel resistance is a general requirement on implementations | Constant-time (`crypto.timingSafeEqual`), and only an exact match is accepted | same |
| **Audit log hash** | Section 4, Table 4.1: SHA-256 is a recommended hash function | SHA-256. The chain is a plain hash, not a MAC (section 5.2), so it carries no key; what that means for tamper detection is stated under AU-9 in the [NIST mapping](https://aquaman.sh/docs/0.19.0/compliance/nist-800-53.md) | [`au-9-au-10-tampering.test.ts`](https://github.com/tech4242/aquaman/blob/v0.19.0/test/compliance/nist/au-9-au-10-tampering.test.ts) |

## Where aquaman differs

- **Key derivation uses PBKDF2, the guideline recommends Argon2id.** PBKDF2-HMAC-SHA256 at 600,000 iterations is an accepted password-stretching function elsewhere (OWASP ASVS 5.0 V11.4.4), but TR-02102-1 section B.1.2 names Argon2id for the case without a hardware token, because it is also costly in memory. The `encrypted-file` backend is the fallback for machines with no keychain or password manager; its strength is the strength of the password.
- **Password entropy is not enforced.** aquaman requires 12 characters and cannot measure entropy. For the 120 bits the guideline asks for, use a generated passphrase (ten or more random words) or one of the other backends.

## What this is not

- Not a certification or an evaluation by BSI or by anyone else.
- Not a statement about the other seven backends, whose cryptography is the vault vendor's. KeePassXC databases are read through `kdbxweb` and `argon2`, which were not assessed here.
- Not a statement about transport: the proxy listens on a Unix socket and, when enabled, on plain HTTP on the loopback interface, and reaches upstream services over the TLS that Node provides. TR-02102-2 (TLS) is not mapped.

## References

- BSI TR-02102, all parts: https://www.bsi.bund.de/EN/Themen/Unternehmen-und-Organisationen/Standards-und-Zertifizierung/Technische-Richtlinien/TR-nach-Thema-sortiert/tr02102/tr02102_node.html
- Run the tests: `npx vitest run test/compliance/bsi/`
