@@ -47,29 +47,31 @@ final class WebAuthnCodecs {
47
47
private static final ByteArray EC_PUBLIC_KEY_OID =
48
48
new ByteArray (
49
49
new byte [] {
50
- 0x2A , - 122 , 0x48 , - 50 , 0x3D , 0x02 , 0x01
50
+ 0x2A , ( byte ) 0x86 , 0x48 , ( byte ) 0xCE , 0x3D , 2 , 1
51
51
}); // OID 1.2.840.10045.2.1 ecPublicKey (ANSI X9.62 public key type)
52
52
private static final ByteArray P256_CURVE_OID =
53
53
new ByteArray (
54
- new byte [] {0x2A , -122 , 0x48 , -50 , 0x3D , 0x03 , 0x01 , 7 }); // OID 1.2.840.10045.3.1.7
54
+ new byte [] {
55
+ 0x2A , (byte ) 0x86 , 0x48 , (byte ) 0xCE , 0x3D , 3 , 1 , 7 // OID 1.2.840.10045.3.1.7
56
+ });
55
57
private static final ByteArray P384_CURVE_OID =
56
- new ByteArray (new byte [] {0x2B , - 127 , 0x04 , 0 , 34 }); // OID 1.3.132.0.34
58
+ new ByteArray (new byte [] {0x2B , ( byte ) 0x81 , 0x04 , 0 , 34 }); // OID 1.3.132.0.34
57
59
private static final ByteArray P512_CURVE_OID =
58
- new ByteArray (new byte [] {0x2B , - 127 , 0x04 , 0 , 35 }); // OID 1.3.132.0.35
60
+ new ByteArray (new byte [] {0x2B , ( byte ) 0x81 , 0x04 , 0 , 35 }); // OID 1.3.132.0.35
59
61
60
62
private static final ByteArray ED25519_ALG_ID =
61
63
new ByteArray (
62
64
new byte [] {
63
65
// SEQUENCE (5 bytes)
64
66
0x30 ,
65
- 0x05 ,
67
+ 5 ,
66
68
// OID (3 bytes)
67
69
0x06 ,
68
- 0x03 ,
70
+ 3 ,
69
71
// OID 1.3.101.112
70
72
0x2B ,
71
- 0x65 ,
72
- 0x70
73
+ 101 ,
74
+ 112
73
75
});
74
76
75
77
static ByteArray ecPublicKeyToRaw (ECPublicKey key ) {
@@ -149,13 +151,10 @@ static PublicKey importCosePublicKey(ByteArray key)
149
151
final int kty = cose .get (CBORObject .FromObject (1 )).AsInt32 ();
150
152
switch (kty ) {
151
153
case 1 :
152
- // COSE-JAVA is hardcoded to ed25519-java provider ("EdDSA") which would require an
153
- // additional dependency to parse EdDSA keys via the OneKey constructor
154
154
return importCoseEdDsaPublicKey (cose );
155
155
case 2 :
156
156
return importCoseEcdsaPublicKey (cose );
157
157
case 3 :
158
- // COSE-JAVA supports RSA in v1.1.0 but not in v1.0.0
159
158
return importCoseRsaPublicKey (cose );
160
159
default :
161
160
throw new IllegalArgumentException ("Unsupported key type: " + kty );
0 commit comments