Skip to content
Almena ID— version v2026-12-beta
Auto
EnglishEN

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), with the construction of the IETF draft (section 4) MUST be verified by everyone; who signs with it is in section 4.
Content encryption A256GCM MUST.
Key establishment Hybrid KEM ML-KEM-768 + P-256 (FIPS 203) with HPKE, with the construction of the IETF draft (section 3) MUST for every key agreement (section 3).
Hash SHA-256 MUST, also in KERI (section 4). 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 SHA-256 of a random nonce followed by the data (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.
Backup key of an entity ES256 key written as 24 BIP39 words (client) MUST for the console.
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 to a person’s new device (client).
  2. DIDComm profile.
    1. The content is encrypted with A256GCM.
    2. The content key is encrypted for each recipient with HPKE and the hybrid KEM ML-KEM-768 + P-256 (ALM-MLKEM768-P256, item 3). 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 and construction. Each encryption key is a single hybrid key ML-KEM-768 + P-256. This applies to relationship keys, entity encryption keys and mediator encryption keys (key inventory).
    1. ALM-MLKEM768-P256 is the key encryption that the IETF draft draft-ietf-jose-hpke-pq-pqt-02 calls HPKE-8-KE: HPKE with the KEM MLKEM768-P256 of draft-ietf-hpke-pq, the KDF SHAKE256 and the AEAD AES-256-GCM.
    2. The key is a JWK of type AKP with that alg. Its pub is the ML-KEM-768 public key followed by the P-256 one (1,249 bytes), and its private key is a 32-byte seed from which the KEM derives both parts.
  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 a hybrid key (1,249 bytes), so they carry only a P-256 key, and what is sent to them is encrypted with classical ECDH-ES (ECDH-ES+A256KW, registries, 5). What travels under that key is limited:
    1. At the counter, the entity’s first message (a presentation-request) MUST NOT carry personal data. 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: ALM-MLDSA65-ES256, which is the construction that the IETF draft draft-ietf-jose-pq-composite-sigs-07 calls ML-DSA-65-ES256. Its keys are JWK of type AKP.
  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. Holder keys according to the chip. Holder keys MUST be ML-DSA-65 + ES256 if the device’s secure chip supports ML-DSA, and ES256 otherwise (client). Manager keys and the backup key are ES256, because they go in the KEL (item 5).
    1. All the copies of a credential batch use the same algorithm.
    2. The algorithm of the holder key can be seen in the key itself (cnf) and in the Key Binding JWT, and each verifier decides whether ES256 is enough for it (P10).
  5. KERI. KERI’s digests (the AID and the digests of the next keys) use SHA-256, with the CESR code I, so every AID starts with I. CESR does not yet define codes for ML-DSA, so in v2026-12-beta the KEL only carries P-256 keys. 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.
  6. Post-quantum managers. When CESR defines codes for ML-DSA, a later version will allow ML-DSA-65 + ES256 manager keys and will require at least one post-quantum signature in each approval of an entity (section 7).
  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 encryption key (keyAgreement).
  3. Hybrid key. The 32-byte private key of k = 1 is the seed of the hybrid encryption key ML-KEM-768 + P-256 (section 3), from which the KEM derives both parts. That way it is recovered with the seed, like the signing key.

  4. Document. The did:peer:4 document contains only these two keys, without services, so the identifier does not change when the mailbox changes. So that the same seed gives the same identifier in any wallet, the document MUST follow exactly this template and be serialized with JCS (RFC 8785) before the did:peer:4 method encodes it:

    {
    "verificationMethod": [
    { "id": "#key-0", "type": "JsonWebKey",
    "publicKeyJwk": { "kty": "EC", "crv": "P-256", "x": "…", "y": "…" } },
    { "id": "#key-1", "type": "JsonWebKey",
    "publicKeyJwk": { "kty": "AKP", "alg": "ALM-MLKEM768-P256", "pub": "…" } }
    ],
    "authentication": ["#key-0"],
    "keyAgreement": ["#key-1"]
    }

    x, y and pub go in base64url without padding. The document carries no id or controller, which the did:peer:4 method adds when resolving it, and no @context.

  5. Not derived from the seed: the device key, the holder keys and the manager keys; they live in the 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 are test vectors, from the seed to the did:peer:4, 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); a wallet needs no list, because each of its keys carries its algorithm and every participant verifies the two signatures of section 4.
  3. Identifiers. While the IETF identifiers of the hybrid algorithms are drafts, the Almena standard fixes its own, with a version, and each one is the construction of a specific revision of the draft (sections 3 and 4). 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. Almena fixes the revision it uses, and 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. A hybrid ML-KEM-768 + P-256 public key takes 1,249 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. CESR defines codes for P-256 keys and signatures, but not yet for ML-DSA (section 4).

None for now.