Skip to content

Wallet and mobile support for ML_DSA_65 identity keys #6394

Backlog

Description

@QuantumExplorer

Follow-up to #6354, which adds the ML_DSA_65 identity key type (key type 5, ML-DSA-65 of FIPS 204) to the protocol from protocol version 16.

After #6354 a node accepts such a key and verifies its signatures, and simple-signer signs with one. The wallet and the mobile SDKs can store and show the key, but cannot derive it or sign with it. This issue tracks closing that gap.

What is missing

A derivation path for the seed

  • The private key of an ML_DSA_65 key is a 32 byte seed. There is no agreed derivation path for it (the DIP-9 identity path has a key type index for ECDSA and BLS only).
  • rs-platform-wallet: IdentityWallet::derive_identity_key_bytes returns InvalidIdentityData("ML_DSA_65 keys are not derived from the wallet").
  • This needs a decision first: the path, and whether the seed is taken from a hardened child key or from a separate derivation.

Signing in the wallet

  • rs-platform-wallet-ffi: the mnemonic resolver signs ECDSA only (dash_sdk_resolver_supports_key_type accepts ECDSA_SECP256K1 and ECDSA_HASH160). BLS12_381 and EDDSA_25519_HASH160 identity keys are in the same position today.
  • An ML_DSA_65 signature is 3,309 bytes, against 65 for ECDSA. Every signature buffer on the signing path has to be checked for that size.
  • Until this exists, an identity whose only usable keys are ML_DSA_65 cannot be operated from the wallet. Key selection already skips a key the signer cannot use, so an identity that also holds ECDSA keys keeps working.

Swift SDK and SwiftExampleApp

Kotlin SDK and KotlinExampleApp

  • The Kotlin KeyType mirror has the values 0 to 4. Reading a key of type 5 throws, so an identity holding one cannot be loaded.
  • KeystoreSigner has the same shape as the Swift signer (a stored private key is signed through the ECDSA helper) and needs the same refusal, then real support.

Fee estimates

  • The estimates made before a key is added assume a small key. The fee charged is for the real size (1,952 bytes of key data, and 100,000 credits per signature check).

Not part of this

  • ML-KEM keys for the ENCRYPTION and DECRYPTION purposes. An ML_DSA_65 key is refused for those purposes.

Activity

  1. QuantumExplorer commented on Nov 30, 2026

    @QuantumExplorer
    MemberAuthor

    One more item for the signer work, from the review of #6354:

    KeychainSigner (Swift) signs ECDSA secp256k1 with any stored private key, whatever the key's type. #6354 makes it refuse an ML_DSA_65 key by name. It still signs:

    • a BLS12_381 or EDDSA_25519_HASH160 key that has a stored private key (testCanSignAcceptsStoredScalarRegardlessOfKeyType asserts this on purpose today), and
    • a key whose stored type this SDK version cannot read (a key type added to the protocol later), if a private key is stored for it.

    The second case needs a row for a future key type that also has a stored private key, so it is not reachable today. When the signer learns to dispatch by key type, it should sign only the types it has a scheme for and refuse the rest, in canSign and in both signing lookups, keeping the platform address path (0xFF) as it is. The Kotlin KeystoreSigner has the same shape.

  2. QuantumExplorer commented on Dec 4, 2026

    @QuantumExplorer
    MemberAuthor

    #6510 adds a second post-quantum signing key type, SLH_DSA_SHA2_128S (key type 8, SLH-DSA-SHA2-128s of FIPS 205, 32 byte seed as private key, 7,856 byte signature). Everything listed here for ML_DSA_65 holds for it as well, so the work can be done for both types together. Three points came up in the review of #6510 and were left to this issue:

    Kotlin KeystoreSigner (already listed above as "needs the same refusal")

    • It answers canSignWith from whether the stored key decrypts, and dispatchSign drops the key type and signs through SignerNative.signWithPrivateKey, which is always ECDSA. This holds for every stored key that is not ECDSA, BLS included, and predates the post-quantum key types.
    • Rust already owns the answer: SingleKeySigner::can_sign_with (ECDSA types with a matching public key, false otherwise), exported as dash_sdk_signer_can_sign. The fix is to pass the public key and key type into the JNI sign helper and ask it before signing, plus a predicate on the key type alone for the preflight, so no secret is requested for a key that cannot be signed with. MasternodeVotingKeySigningTest exercises that path and changes with it.
    • Swift's KeychainSigner.refusesKeyType is a list kept in Swift, and it lets BLS, BIP13 and EdDSA keys through. It should move to the same Rust predicate.

    Swift KeySizeValidator

    • expectedPrivateKeySize(for:) is a Swift table of private key sizes with an entry per key type and no caller in the SDK or the example app. The real check is Rust's (dash_sdk_validate_private_key_for_public_key). The table should be removed, or read from Rust, for all key types at once.

    wasm-dpp2 signing with a seed

    • StateTransition.sign and signByPrivateKey take a PrivateKey, which must be a valid secp256k1 scalar. A seed of an ML_DSA_65 or SLH_DSA_SHA2_128S key that is zero or not below the curve order is refused before dpp sees it. Random seeds practically never are, but signing with these key types from JavaScript needs an input that is bytes and a key type, not an ECDSA private key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions