tmkms icon indicating copy to clipboard operation
tmkms copied to clipboard

feat!: Ed25519 expanded signing key

Open melekes opened this issue 4 months ago • 2 comments

This PR adds support for expanded ed25519 keys, enabling compatibility with different key formats (including those exported from YubiHSM).

Copilot Summary

This pull request introduces support for expanded Ed25519 signing keys in the keyring, enabling compatibility with different key formats (including those exported from YubiHSM) and providing more flexible signing capabilities. The changes refactor the SigningKey type to handle both standard and expanded keys.

Expanded Ed25519 key support and refactoring:

  • Refactored the SigningKey type from a struct to an enum, allowing it to represent either a standard Ed25519 signing key (Ed25519) or an expanded Ed25519 signing key (Ed25519Expanded). This enables handling multiple key formats.
  • Updated methods in SigningKey to correctly process both key types for serialization (as_bytes), verification key conversion (verifying_key), and external key conversions (e.g., to tendermint_p2p::secret_connection::PublicKey).
  • Enhanced the TryFrom<&[u8]> for SigningKey implementation to support parsing seed keys, big-endian expanded keys, and little-endian expanded keys (such as those exported from YubiHSM), improving compatibility with external hardware and key sources.
  • Modified the signing logic in the Signer<Signature> implementation to use the appropriate signing method for expanded keys (raw_sign), ensuring correct signature generation for both key types.

Dependency addition:

  • Added the ed25519-dalek crate with the hazmat feature to Cargo.toml, providing the necessary cryptographic primitives for expanded Ed25519 key support.

melekes avatar Aug 11 '25 17:08 melekes

@tarcieri I can put it behind a feature flag if needed.

melekes avatar Aug 11 '25 17:08 melekes

hey! just chiming it to say thank you for taking the time to develop this feature. it's greatly appreciated and we've found it useful when dealing with yubihsm-exported keys

tschuyebuhl avatar Aug 11 '25 17:08 tschuyebuhl

Closing in favor of #1096

tony-iqlusion avatar Nov 07 '25 19:11 tony-iqlusion