Skip to content

Commit 3b672e2

Browse files
committed
Rename constant ED25519_CURVE_OID to ED25519_ALG_ID
1 parent 2c51f98 commit 3b672e2

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

webauthn-server-core/src/main/java/com/yubico/webauthn/WebAuthnCodecs.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,20 @@ final class WebAuthnCodecs {
5858
private static final ByteArray P512_CURVE_OID =
5959
new ByteArray(new byte[] {0x2B, -127, 0x04, 0, 35}); // OID 1.3.132.0.35
6060

61-
private static final ByteArray ED25519_CURVE_OID =
62-
new ByteArray(new byte[] {0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70});
61+
private static final ByteArray ED25519_ALG_ID =
62+
new ByteArray(
63+
new byte[] {
64+
// SEQUENCE (5 bytes)
65+
0x30,
66+
0x05,
67+
// OID (3 bytes)
68+
0x06,
69+
0x03,
70+
// OID 1.3.101.112
71+
0x2B,
72+
0x65,
73+
0x70
74+
});
6375

6476
static ByteArray ecPublicKeyToRaw(ECPublicKey key) {
6577

@@ -245,7 +257,7 @@ private static PublicKey importCoseEd25519PublicKey(CBORObject cose)
245257
throws InvalidKeySpecException, NoSuchAlgorithmException {
246258
final ByteArray rawKey = new ByteArray(cose.get(CBORObject.FromObject(-2)).GetByteString());
247259
final ByteArray x509Key =
248-
encodeDerSequence(ED25519_CURVE_OID, encodeDerBitStringWithZeroUnused(rawKey));
260+
encodeDerSequence(ED25519_ALG_ID, encodeDerBitStringWithZeroUnused(rawKey));
249261

250262
KeyFactory kFact = KeyFactory.getInstance("EdDSA");
251263
return kFact.generatePublic(new X509EncodedKeySpec(x509Key.getBytes()));

0 commit comments

Comments
 (0)