Skip to content

Fix EcdsaVerify.CheckECDsa when cert is OpenSSL #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Yubico.YubiKey/src/Yubico/YubiKey/Cryptography/EcdsaVerify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ public class EcdsaVerify : IDisposable
private const int P384KeySize = 384;
private const string OidP256 = "1.2.840.10045.3.1.7";
private const string OidP384 = "1.3.132.0.34";
private const string NameP256 = "nistP256";
private const string NameP384 = "nistP384";

private const byte EncodedPointTag = 4;
private const int SequenceTag = 0x30;
Expand Down Expand Up @@ -405,10 +403,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,
};

Expand Down