-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
RSACertificateExtensions.GetRSAPublicKey Error #86845
Comments
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones Issue DetailsThe result is different in.net7 and.net8
|
They both return an |
Stephen is correct, this was an intentional change for .NET 8. The return type will vary by operating system already, so you should avoid casting it to a specific implementation. Ideally you would just use the return value as it is without casting it - this will ensure correct cross-platform behavior. If you really need an RSACng instance because you only need to support Windows, you can round trip the parameters to the desired concrete type: RSA rsa = cert.GetRSAPublicKey();
RSACng cng = new RSACng();
cng.ImportParameters(rsa.ExportParameters(false));
rsa.Dispose(); Since this is working as intended, and there are solutions to continue to use RSACng if needed, I am going to close this out. If you feel this has been inadequately answered, please feel free to re-open the issue. Thanks! |
The result is different in.net7 and.net8
.net7 returns RSACng, which is correct
.net8 returns RSABCrypt
The following is the code
The text was updated successfully, but these errors were encountered: