aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/keys.rs
Commit message (Collapse)AuthorAgeFilesLines
* continuum-party: signing through an ssh-agentslopulus79 min.1-0/+146
| | | | | | | | | | | | | | A key held in hardware is never a file: only an ssh-agent signs with it. Given a public key as `--key` (a `.pub` file, `ssh-ed25519` or `ecdsa-sha2-nistp256`), the client asks the agent at `SSH_AUTH_SOCK` to sign what SSHSIG signs (a sign request with the key's blob, no flags) and writes the blob around the agent's signature as `ssh-keygen -Y sign` does. An ECDSA signature the agent gives with a high `s` is made low, the other of its two spellings, which the federation takes. What it makes is checked before it is used. A private key file signs as it did. A test starts `ssh-agent`, adds an ECDSA and an Ed25519 key to it and deletes their files, signs through it, and has both continuum and `ssh-keygen -Y verify` check each signature, one of an agent's high-S answers among them. Without OpenSSH it asks nothing.
* keys: a party's key may be ecdsa-sha2-nistp256, its signature low-S onlyslopulus79 min.1-30/+253
| | | | | | | | | | | | | | | | | | | | 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.
* federation: keys, node IDs and signatures, each spelled one waytv27 hours1-0/+147
A key is `ssh-ed25519`, one space, and its base64, padded and canonical, with no comment, its 32 bytes an Ed25519 public key; a node ID is spelled as continuum spells it, its key one too; and a signature is the SSHSIG blob of version 1 for the namespace `continuum-federation`, hashed with `sha512`, its reserved field empty, its key the event's, in base64, padded and canonical, unarmored, checked by continuum's strict check (`access::sshsig::verify_blob`) and read back to what `ssh-keygen` writes around it. `keys::sign` makes one, for clients and tests. Tests show each spelled otherwise taken for none.