Skip to content
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

Exception type is updated from .NET 7 and up #1535

Merged
merged 1 commit into from
Mar 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public override AsymmetricSecurityKey ToSecurityKey()
// handling this as it typically means the user profile is not loaded, and this is about the best way to detect this.
// when the user profile is not loaded, using X509KeyStorageFlags.MachineKeySet is the only way for this to work on windows.
// https://stackoverflow.com/questions/52750160/what-is-the-rationale-for-all-the-different-x509keystorageflags/52840537#52840537
catch (Exception ex) when (ex.GetType().Name == "WindowsCryptographicException")
catch (CryptographicException ex) when (ex.HResult == unchecked((int)0x80070002)) // File not found
{
_cert = new X509Certificate2(Convert.FromBase64String(CertificateRawData), (string) null, X509KeyStorageFlags.MachineKeySet);
}
Expand Down
Loading