From a1e398621eec9472ad67f1eafeba9ff23b012c2f Mon Sep 17 00:00:00 2001 From: slopulus Date: Tue, 17 Nov 2026 19:57:56 +0100 Subject: keys: a party's key may be ecdsa-sha2-nistp256, its signature low-S only A party's keys may be held where no file has them, in a Secure Enclave or a phone, and those are ECDSA keys on NIST P-256. Everywhere a party's key counts (a version's keys, a key set, the key an event is signed with) such a key is taken beside an Ed25519 one, spelled as `ssh-keygen` writes it, without a comment: `ecdsa-sha2-nistp256`, a space, and the base64 of its SSH encoding, its point uncompressed and on the curve. Its signature is SSHSIG as an Ed25519 one is, hashed with `sha512`, its inner signature over SHA-256 as SSH signs with such a key. ECDSA signatures are malleable: of `s` and the curve's order less `s`, both check. So the federation takes one spelling alone: `s` low, at most half the order, `r` and `s` each SSH's shortest mpint, and the blob reading back to itself as an Ed25519 one does. What anyone makes of a party's signature is then none, as before. The vectors are a key `ssh-keygen -t ecdsa -b 256` made, a first version naming it, and a write and a key set `ssh-keygen -Y sign` signed with it, each taken; the signature's high-S twin, which checks as ECDSA, and its `r` spelled longer are none. Ed25519 keys and signatures are spelled and checked as they were. --- src/federation/event.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/federation/event.rs') diff --git a/src/federation/event.rs b/src/federation/event.rs index 00c7018..15cee45 100644 --- a/src/federation/event.rs +++ b/src/federation/event.rs @@ -5,7 +5,6 @@ use super::jcs::{self, Json}; use super::keys; use super::store::Id; use super::version::{self, Version}; -use crate::access::sshsig::PublicKey; /// The most bytes an event may have. pub(crate) const LARGEST: usize = 256 * 1024; @@ -229,7 +228,7 @@ impl Event { } /// The key a signed event is signed with. - pub(crate) fn public(signed: &Signed) -> PublicKey { + pub(crate) fn public(signed: &Signed) -> keys::Key { keys::key(&signed.key).expect("an event's key was read as one") } } -- cgit v1.3.1