Skip to content

Commit

Permalink
Fix EcdsaVerify.CheckECDsa when cert is OpenSSL
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
alanssitis committed Apr 18, 2024
1 parent 3363144 commit 752ed65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 408 in Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs

View workflow job for this annotation

GitHub Actions / test

Identifier expected
{
NameP256 => (P256EncodedPointLength - 1) / 2,
NameP384 => (P384EncodedPointLength - 1) / 2,
OidP256 => (P256EncodedPointLength - 1) / 2,
OidP384 => (P384EncodedPointLength - 1) / 2,
_ => -1,
};

Expand Down

0 comments on commit 752ed65

Please sign in to comment.