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

Add der_spki() methods for all supported key types #309

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

jschanck
Copy link
Collaborator

The getPublicKey() method in WebAuthn Level 3 outputs a DER encoded SubjectPublicKeyInfo, and it has the following requirement:

User agents MUST be able to return a non-null value for getPublicKey() when the credential public key has a COSEAlgorithmIdentifier value of:

-7 (ES256), where kty is 2 (with uncompressed points) and crv is 1 (P-256).
-257 (RS256).
-8 (EdDSA), where crv is 6 (Ed25519).

This PR adds der_spki() methods for RS256 and Ed25519 and improves the serialization tests for all key types.

It turns out that #292 did not resolve all of the issues with the CBOR encoding of OKP keys (see also: Firefox Bug 1852812 and references therein), so I've included a patch for that as well.

Copy link
Collaborator

@mozkeeler mozkeeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

src/crypto/der.rs Outdated Show resolved Hide resolved
src/crypto/mod.rs Outdated Show resolved Hide resolved
@jschanck jschanck merged commit f96f753 into mozilla:ctap2-2021 Sep 15, 2023
8 checks passed
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.

2 participants