Skip to content

Commit 9d37340

Browse files
committed
fix: update algorithm entry in CoseEcPublicKey to use dynamic value instead of hardcoded constant; improve clarity in CoseEdDsaPublicKeyTests
1 parent a0b38be commit 9d37340

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Yubico.YubiKey/src/Yubico/YubiKey/Fido2/Cose/CoseEcPublicKey.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ public override byte[] Encode()
295295

296296
return new CborMapWriter<int>()
297297
.Entry(TagKeyType, (int)CoseKeyType.Ec2)
298-
// .Entry(TagAlgorithm, (int)Algorithm) // Should be correct, right? Instead of hardcoding -25
299-
.Entry(TagAlgorithm, (int)CoseAlgorithmIdentifier.ECDHwHKDF256)
298+
.Entry(TagAlgorithm, (int)Algorithm)
300299
.Entry(TagCurve, (int)Curve)
301300
.Entry(TagX, XCoordinate)
302301
.Entry(TagY, YCoordinate)

Yubico.YubiKey/tests/unit/Yubico/YubiKey/Fido2/Cose/CoseEdDsaPublicKeyTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public class CoseEdDsaPublicKeyTests
2222
.Replace("-----BEGIN PUBLIC KEY-----", "")
2323
.Replace("-----END PUBLIC KEY-----", "")
2424
.Replace("\n", "")
25-
.Trim()
26-
).Skip(12).ToArray(); // Skip the COSE key header and extract the public key data
25+
.Trim())
26+
.Skip(12) // Skip the ASN.1 metadata bytes and keep only the public key data (32 bytes)
27+
.ToArray();
2728

2829
[Fact]
2930
public void CreateFromPublicKeyData_ValidKey_ReturnsExpectedKey()

0 commit comments

Comments
 (0)