Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smaller keyhandle length #8

Closed

Conversation

szszszsz
Copy link
Contributor

@szszszsz szszszsz commented Jan 8, 2022

Remove some fields from credential data serialization while making credential ID.
Reduces key handle size by around 30% (from ~320 to ~220). Tested on Gitlab, and this patch makes it working correctly (both registering and signing, as opposed to 500 error code returned otherwise).
Presumably the hidden limit is 255 bytes, which would be compatible with CTAP1.

cc @jans23 @robin-nitrokey

To do:

  • remove commented code
  • discuss extensions fields

@robin-nitrokey
Copy link
Member

@szszszsz Is my understanding correct that this change is backwards-compatible because we can still deserialize the old key handles that include the now absent fields?

@szszszsz
Copy link
Contributor Author

szszszsz commented Jan 10, 2022

That's correct. This should not affect previous registrations at all. What's left is to make sure, if the extension fields can be safely skipped, or do they need to be encoded, and checked on assertion getting with the browser's request.

By the way, here are my notes from testing the key handles' lengths:
(webauthn.bin.coffee, Chromium)

- Apparent key handle lengths taken from Chromium debug log:
	- YK5: 64 bytes
	- Solo2: 324 bytes 
		- wrapped key: 92 bytes
			- comments:
			// 32B key, 12B nonce, 16B tag + some info on algorithm (P256/Ed25519)
			// Turns out it's size 92 (enum serialization not optimized yet...)
		- another nonce?: 12 bytes
		- key encryption key -> credential_id
		- cred_id -> serialization -> 324 bytes (value confirmed in debugger)
	- Nitrokey FIDO2: 70 bytes

@szszszsz szszszsz marked this pull request as ready for review January 12, 2022 19:25
szszszsz added a commit to Nitrokey/fido-authenticator that referenced this pull request Jan 15, 2022
Remove some fields from credential data serialization while making
credential ID. Reduces key handle size by around 30% (from ~320 to
~220). Tested on Gitlab, and this patch makes it working correctly
(both registering and signing, as opposed to 500 error code returned
otherwise). Presumably the hidden limit is 255 bytes, which would be
compatible with CTAP1.

Related: trussed-dev#8
@szszszsz
Copy link
Contributor Author

Note: we have reports that this is not backwards compatible for some users.

Some services do not accept arbitrary long key handle (aka Credential
ID), which makes the FIDO operations failing. This patch removes some
fields from credential data serialization while making credential ID,
and with this it reduces key handle size by around 30% (from ~320 to ~220
using test site [1]). Tested on Gitlab, and this patch makes it working
correctly (both registering and signing, as opposed to 500 error code
returned otherwise). Presumably the hidden limit is 255 bytes, which
would be compatible with CTAP1.

Resident Keys stay the same, with full metadata stored on the device.

[1] webauthn.bin.coffee
@szszszsz
Copy link
Contributor Author

szszszsz commented Feb 1, 2022

Rebased on main branch

@nickray
Copy link
Member

nickray commented Mar 5, 2022

Closing this PR in favor of a major rework (which includes your ID shortening).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants