Skip to content
Almena Network— version v2026-12-beta
Auto
English

Cryptography specification

Algorithms, encryption, signatures and key derivation that every component of Almena must use. The other documents say which keys each participant has and what it signs or encrypts; this document says how. The key inventory summarizes every key.

Almena aims to protect data for decades, so it plans for computers able to break P-256 (quantum computers). The risk is not the same for everything:

  • Encryption is exposed today. Whoever stores encrypted messages now could decrypt them when that computer exists (harvest now, decrypt later). That is why encryption is already hybrid (section 3).
  • Signatures can only be forged from that moment on. What matters is to have changed algorithm before then, which is why signatures are migrated gradually (sections 4 and 7).

Hybrid means combining a classical algorithm with a post-quantum one, so that security holds while either of the two holds.

Use Algorithm Requirement
Classical signature ES256 (ECDSA over P-256, SHA-256) MUST be supported by everyone.
Hybrid signature Composite ML-DSA-65 + ES256 (ML-DSA, FIPS 204) MUST be verified by everyone; who signs with it is in section 4.
Content encryption A256GCM MUST.
Key establishment Hybrid KEM ML-KEM-768 (FIPS 203) + ECDH over P-256 MUST for every key agreement (section 3).
Hash SHA-256 MUST. A quantum computer does not weaken it enough to matter.
Key derivation from the seed SLIP-10 over P-256, hardened only (section 5) MUST.
Commitment of a record SHA-256 of a random salt of at least 256 bits plus the details (network, 7) MUST.
Storage proofs Merkle tree with SHA-256 (network, 9) MUST.
Social recovery Shamir secret sharing, 3 of 5 (client) MAY (social recovery is optional).
Recovery kit BIP39 words for the seed (client) MAY.
TLS Hybrid key exchange: ML-KEM-768 with X25519 or P-256 Section 3.
  1. Hybrid key establishment (MUST). Every key agreement combines ML-KEM-768 with ECDH over P-256. It applies to:
    1. DIDComm messages between participants (interface, 2);
    2. the channel between the entity console and the entity node (interface, 10);
    3. the private replica between nodes of the same entity (network, 6.4.1);
    4. the direct transfer between a person’s devices (client).
  2. DIDComm profile.
    1. The content is encrypted with A256GCM.
    2. The content key is established for each recipient with the hybrid KEM ML-KEM-768 + ECDH-ES over P-256. Anonymous encryption is used, because ECDH-1PU has no hybrid version.
    3. When the recipient must know who sends, the message is signed with the sender’s key before being encrypted.
    4. A message for several recipients (for example, the entity nodes of an entity) carries the content key encapsulated for each of them.
    5. A participant MUST support this profile.
  3. Encryption keys. Each encryption key is a hybrid pair: a P-256 key and an ML-KEM-768 key. This applies to relationship keys, entity encryption keys and mediator encryption keys (key inventory).
  4. Transport.
    1. TLS connections to a node SHOULD use a hybrid key exchange (ML-KEM-768 with X25519 or P-256). DIDComm content is already protected end to end; this also protects the metadata.
    2. The channel between the console and the entity node MUST use a hybrid key agreement.
    3. The channel between nodes SHOULD use a hybrid key agreement, and between nodes of the same entity it MUST (node, 6).
  5. Two QR codes without ML-KEM. The counter QR code and the console sign-in QR code have no room for an ML-KEM key (1,184 bytes), so they carry only a P-256 key. What travels under that key is limited:
    1. At the counter, the entity’s first message MUST NOT carry personal data: only its did:keri and the invitation to continue. Everything is hybrid from the wallet’s reply onwards (protocols).
    2. At sign-in, the manager credential is not secret, because a manager acts publicly on behalf of the entity.
  1. Formats. Credentials are SD-JWT VC and are presented with a Key Binding JWT; messages between nodes and signed DIDComm messages are JWS; KERI events use CESR (vision, 5.2). Each signature states its algorithm (alg in JOSE, the code in CESR).
  2. Everyone verifies both. Every participant MUST verify ES256 and ML-DSA-65 + ES256 signatures. The composite signature fits in an SD-JWT VC because it is a single alg.
  3. Keys of the entity node (SHOULD). The keys that the entity node keeps in protected storage (issuing, record and the one with which the entity acts as a holder) SHOULD sign with ML-DSA-65 + ES256.
  4. Device keys according to the chip. Holder keys and manager keys MUST be ML-DSA-65 + ES256 if the device’s secure chip supports ML-DSA, and ES256 otherwise (client).
    1. All the copies of a credential batch use the same algorithm.
    2. The wallet attestation states the algorithm of the holder key, and each verifier decides whether ES256 is enough for it (P10).
  5. KERI. Pre-rotation already protects control of an entity: the next keys are only published as a digest, so a quantum computer cannot deduce them and take control of the identity. The KEL MUST accept ML-DSA keys (their CESR codes) so that an entity can rotate to them.
  6. Post-quantum threshold. If the managers with ES256 keys alone can reach the M-of-N threshold, the entity is only as strong as those keys against a quantum computer. The console SHOULD warn of this (client).
  7. Other signatures. Node keys (heartbeats, entries, evidence, GET /1.0/info) and push notices use ES256 in v2026-12-beta; they protect nothing that must stay secret over time.
  1. Seed. Each wallet profile is born from a random 256-bit seed generated on the device (client).
  2. Path. With SLIP-10 over P-256, hardened only: m / 4279373' / a' / b' / c' / d' / k', where:
    1. 4279373 is “ALM” in ASCII;
    2. a to d are the first 16 bytes of the SHA-256 of the entity’s did:keri, split into four 31-bit indices;
    3. k is 0 for the signing key (authentication) and 1 for the P-256 encryption key (keyAgreement).
  3. ML-KEM key. The ML-KEM-768 key is generated deterministically (FIPS 203) from the 32-byte private keys of k = 2 (seed d) and k = 3 (seed z). That way it is recovered with the seed, like the others.
  4. Document. The did:peer:4 document contains only these keys, without services, so the identifier does not change when the mailbox changes.
  5. Not derived from the seed: the device key, the holder keys and the manager keys; they live in each device’s secure chip.
From the seed to the keys of each relationship

The same seed and the same entity always give the same keys, so the identifier with each entity is stable and is recovered with the seed. Different entities give branches that nobody can link without the seed (F2). There is a test vector in the example of a payment with a token.

  1. Devices. The keys that must not leave the device (device key, holder keys and manager keys) live in the hardware key store, non-exportable (client).
  2. Entity node. The entity’s keys for daily use live in protected key storage (a hardware security module or equivalent), from which they cannot be extracted (network, 6.4).
  3. Console. It only has an ephemeral session key, in memory.
  1. Every element says its algorithm, so that algorithms can change without changing the protocols (P9).
  2. Who supports what. Each node publishes the algorithms it supports in GET /1.0/info (interface, 8); each wallet, in its wallet attestation.
  3. Identifiers. While the IETF identifiers of the hybrid algorithms are drafts, the Almena standard fixes its own, with a version. When the IETF ones are final, a new version adopts them.
  4. Calendar.
    1. Signatures with ES256 alone will be withdrawn in a later version, before 2030, in line with NIST IR 8547.
    2. A later version will require at least one post-quantum signature in each approval of an entity.
  • Privacy during the transition. While few devices have post-quantum keys, the algorithm of the holder key distinguishes its holder and makes presentations easier to link (F2). The wallet SHOULD tell the person so before using them, until they are common (client).
  • BBS. It is not post-quantum: its proofs keep their privacy even against a quantum computer, but its signatures could be forged. It could only be adopted together with a post-quantum signature (vision, 5.2).
  • Drafts. ML-DSA in JOSE and COSE is already a standard (RFC 9964), but ML-KEM in JWE (through HPKE), composite signatures and the hybrid libp2p handshake are still drafts. Their identifiers may change (section 7).
  • DIDComm v2 has no post-quantum profile. Almena defines its own (section 3), which other DIDComm implementations will not understand until they adopt it.
  • Size. An ML-KEM-768 public key takes 1,184 bytes and an ML-DSA-65 signature 3,309 bytes, compared with 65 and 64 bytes in P-256. Messages, credentials and DID documents become larger.
  • Devices. Not all secure chips support ML-DSA yet; that is why section 4 depends on the chip.
  • P-256 in CESR. Support for P-256 in CESR and in KERI libraries must be confirmed; CESR already defines codes for ML-DSA.

None for now.