@@ -52,6 +52,7 @@ import com.yubico.webauthn.data.UserVerificationRequirement
52
52
import com .yubico .webauthn .exception .InvalidSignatureCountException
53
53
import com .yubico .webauthn .extension .appid .AppId
54
54
import com .yubico .webauthn .test .Helpers
55
+ import com .yubico .webauthn .test .RealExamples
55
56
import com .yubico .webauthn .test .Util .toStepWithUtilities
56
57
import org .junit .runner .RunWith
57
58
import org .scalacheck .Gen
@@ -1946,6 +1947,55 @@ class RelyingPartyAssertionSpec
1946
1947
test(RegistrationTestData .Packed .SelfAttestationRs1 )
1947
1948
}
1948
1949
}
1950
+
1951
+ it(" a U2F-formatted public key." ) {
1952
+ val testData = RealExamples .YubiKeyNeo .asRegistrationTestData
1953
+ val x = ByteArray .fromHex(
1954
+ " 39C94FBBDDC694A925E6F8657C66916CFE84CD0222EDFCF281B21F5CDC347923"
1955
+ )
1956
+ val y = ByteArray .fromHex(
1957
+ " D6B0D2021CFE1724A6FE81E3568C4FFAE339298216A30AFC18C0B975F2E2A891"
1958
+ )
1959
+ val u2fPubkey = ByteArray .fromHex(" 04" ).concat(x).concat(y)
1960
+
1961
+ val cred1 = RegisteredCredential
1962
+ .builder()
1963
+ .credentialId(testData.assertion.get.response.getId)
1964
+ .userHandle(testData.userId.getId)
1965
+ .publicKeyCose(u2fPubkey)
1966
+ .signatureCount(0 )
1967
+ .build()
1968
+
1969
+ val cred2 = RegisteredCredential
1970
+ .builder()
1971
+ .credentialId(testData.assertion.get.response.getId)
1972
+ .userHandle(testData.userId.getId)
1973
+ .publicKeyCose(u2fPubkey)
1974
+ .signatureCount(0 )
1975
+ .build()
1976
+
1977
+ for { cred <- List (cred1, cred2) } {
1978
+ val rp = RelyingParty
1979
+ .builder()
1980
+ .identity(testData.rpId)
1981
+ .credentialRepository(
1982
+ Helpers .CredentialRepository .withUser(testData.userId, cred)
1983
+ )
1984
+ .build()
1985
+
1986
+ val result = rp.finishAssertion(
1987
+ FinishAssertionOptions
1988
+ .builder()
1989
+ .request(testData.assertion.get.request)
1990
+ .response(testData.assertion.get.response)
1991
+ .build()
1992
+ )
1993
+
1994
+ result.isSuccess should be(true )
1995
+ result.getUserHandle should equal(testData.userId.getId)
1996
+ result.getCredentialId should equal(testData.response.getId)
1997
+ }
1998
+ }
1949
1999
}
1950
2000
1951
2001
describe(" The default RelyingParty settings" ) {
0 commit comments