Agent protocol changes related to U2F/FIDO2 keys

Ron Frederick ronf at timeheart.net
Wed Dec 11 15:19:47 AEDT 2019


On Dec 10, 2019, at 3:36 PM, Damien Miller <djm at mindrot.org> wrote:
> On Fri, 6 Dec 2019, Ron Frederick wrote:
> 
>> I spent some time today implementing support for loading U2F keys into
>> the SSH agent from my AsyncSSH library. I got it working, but along
>> the way I ran into a few issues I wanted to report:
>> 
>> First, it looks like the value of SSH_AGENT_CONSTRAIN_EXTENSION has
>> changed from the value 3 defined at
>> https://tools.ietf.org/html/draft-miller-ssh-agent-02 to the value 255
>> now, and somewhere along the way the constraint
>> SSH_AGENT_CONSTRAIN_MAXSIGN was defined to use the value 3.
> 
> Yes, I had already updated the I-D back in July to fix this collision:
> https://tools.ietf.org/html/draft-miller-ssh-agent-03 <https://tools.ietf.org/html/draft-miller-ssh-agent-03>

Ah, thanks. Is the MAXSIGN constraint defined anywhere?

>> Also, this documentation doesn’t define the format of the key data
>> sent to the agent for SK keys with certificates. Similar to plain
>> ECDSA keys with certificates, the key data sent for ECDSA SK keys
>> omits the curve_id and Q value of the ECDSA key that would normally be
>> written out when serializing a local private key. So, the data sent to
>> the agent for an ECDSA SK key with certificate looks like:
>> 
>> 	<snip>
> 
> I don't think that's quite right as it has the pubkey/cert expanded rather
> than encoded in a string - for all certificates, including sk-* the wire
> format for private keys should be:
> 
> 	string		key type
> 	string		public key (including certificate data)
> 	...		private key fields
> 
> E.g.
> 
> 	string		"sk-ecdsa-sha2-nistp256-cert-v01 at openssh.com"
> 	string		pubkey
> 	string		application
> 	uint8		flags
> 	string		key_handle
> 	string		reserved

You’re right - I was focusing on what the additional fields were when I wrote that (which aren’t wrapped in a string), but missed the fact that the prior public key or cert data is.


> You're correct that this is not documented in PROTOCOL.u2f. I'll update
> that now.

Thanks!


>> If the instant was to avoid duplicating what was already in the
>> certificate, though, I’m not sure why “application” is sent twice. It
>> seems like that should have been left out along with the curve_id and
>> Q value, appending only the flags, key_handle, and reserved values
>> from the private key at the end.
> 
> Yeah, application is accidentally repeated. I don't think that I'll touch
> it for now, unless there is some other change that requires changing the
> serialisation format.

I’m fine either way on this, but it isn’t just the application. In the Ed25519 case, it’s both the public key and application fields that end up being repeated. It would be nice if both of these cases could be made consistent, with the appended data being only the flags, key_handle, and reserved values from the private key, skipping over the fields present in the public key in both cases. Right now, you skip over the curve name and Q values in the ECDSA case, but not the application, and you don’t skip over any of the values from the public key in the Ed25519 case.
-- 
Ron Frederick
ronf at timeheart.net





More information about the openssh-unix-dev mailing list