From 752ed655096fff2327288c14c28f3cf7f3576980 Mon Sep 17 00:00:00 2001 From: Alan Chung Ma Date: Thu, 18 Apr 2024 12:28:04 -0400 Subject: [PATCH] Fix EcdsaVerify.CheckECDsa when cert is OpenSSL Certificate OID friendly name is not cross-platform. The certificate on Windows is of type ECDsaCng while on Ubuntu it is of type ECDsaOpenSsl. This causes the friendly names to differ, where it's `nistP256` with ECDsaCng and `ECDSA_P256` with ECDsaOpenSsl. The OID value is the same with both. Signed-off-by: Alan Chung Ma --- .../src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs b/Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs index 3763e0954..149ae1bf3 100644 --- a/Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs +++ b/Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs @@ -405,10 +405,10 @@ private static ECDsa CheckECDsa(ECDsa toCheck) { ECParameters eccParams = toCheck.ExportParameters(false); - int coordinateLength = eccParams.Curve.Oid.FriendlyName switch + int coordinateLength = eccParams.Curve.Oid.Value. switch { - NameP256 => (P256EncodedPointLength - 1) / 2, - NameP384 => (P384EncodedPointLength - 1) / 2, + OidP256 => (P256EncodedPointLength - 1) / 2, + OidP384 => (P384EncodedPointLength - 1) / 2, _ => -1, };