Conversation
Test Results2 305 tests 2 297 ✅ 1m 3s ⏱️ Results for commit 5e6177c. ♻️ This comment has been updated with latest results. |
emlun
left a comment
There was a problem hiding this comment.
Alright! 🙂 we'll also need corresponding constants in PublicKeyCredentialParameters, and to add Ed448 to the default preferredPubkeyParams (also in RelyingPartyV2). I'd say to add it after ES512, since Ed448 and ES512 are at the same security level and the current default prefers ES256 over EdDSA.
Then we also need some tests! 🙂
-
First off, that
Ed448is included in emittedpubKeyCredParamswhen available. You can duplicate this test and replace theEdDSAconstant references (but not theKeyFactoryargument, I think) withEd448:(also inRelyingPartyRegistrationSpec) -
We also need some tests of using Ed448:
So I guess for that I'll need to show you how the
RegistrationTestDataGeneratorworks 😄 (of course if we can find some real examples that's great too, but I don't know of any popular authenticator implementations off the top of my head.)You can run that class in your IDE, and it will go through a hardcoded list of
RegistrationTestDatainstances and callregenerate()on each of them. Then for each test data index it'll print the index in the list, and then a block of code to paste over thenew RegistrationTestData(...)for that test data set. After that you can run the code formatter and commit the new or updated test data. This way we have a set of test vectors that are stable even after changes to the code that originally generated them, but which can be easily updated whenever needed. Most of these are also listed in thedefaultSettingsValidExamplesconstant, which is used inRelyingPartyRegistrationSpecto check that all of those test cases work with the default settings.So for this we can start by duplicating the
val BasicAttestationEdDsaasval BasicAttestationEd448and just update the constant inregenerate(), then add that to the list inregenerateTestDataand todefaultSettingsValidExamples, and then runRegistrationTestDataGeneratorto generate the test case. For this we'll probably need to add some switch cases inTestAuthenticator.scala(regenerate()callscreateBasicAttestedCredentialwhich eventually ends up ingenerateKeypair, and you'll also need to update theKeyPairGenerator argumentfurther down that call chain) andWebauthnCodecstoo.I realize that's a lot to dig into, so let me know if you need any help and/or guidance with it 😄
See "JCA Identifier Strings" at https://bugs.openjdk.org/browse/JDK-8190219 All three of these are valid identifiers for `KeyFactory` and `Signature` (and presumably `"EdDSA"` specializes depending on the type of the key), but `"Ed25519"` and `"Ed448"` are a bit more specific.
emlun
left a comment
There was a problem hiding this comment.
Looks good! I fixed a few small issues, refactored a couple things and tweaked code style a bit: https://github.com/Yubico/java-webauthn-server/pull/429/files/9cb7678ec627b8c40c8584ed6ac1dc7410e9215d..40acf2117024faf2192ea968bfcab3f513c05e61
- I noticed that we're sometimes using the JCA identifier
"EdDSA"(since before) and sometimes"Ed25519"or"Ed448", so I got curious about which is most appropriate. This led me to notice that some of theseswitchstatements are no longer exhaustive, so I added tests to catch that: 14fa04a and 48464e4. d8f634d doesn't have a test, but rather addresses similar warnings from the Scala compiler. - Then commit 1f2c6b3 makes the change to using only the
"Ed25519"and"Ed448"identifiers. - I noticed that the COSE
algof the key in theBasicAttestationEd448test case was set to -7 (EdDSA), because that was still hard-coded ineddsaPublicKeyToCose: 070d895 and 3e06a2a. - Most of commits 03a2109 through 40acf21 are various refactorings and some subjective code style fixes. I think these changes make the code easier to read and follow (most of the affected code is from before the PR).
Fixes #319