Cryptography Next Generation APIs and PlatformNotSupportedException #38197
-
Question re. CNG APIs in .NET StandardDocumentation for numerous APIs in Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
CNG is Windows-specific. The CNG types ( If you want cross-platform cryptographic primitives, the factory methods on the primitives should be used. For example: using (var rsa = System.Security.Cryptography.RSA.Create())
{
//Use `rsa` here
} and |
Beta Was this translation helpful? Give feedback.
CNG is Windows-specific. The CNG types (
RSACng
, etc) will only work on Windows, and throwPlatformNotSupportedException
on non-Windows platforms.If you want cross-platform cryptographic primitives, the factory methods on the primitives should be used. For example:
and
Create
will give you anRSA
implementation that will work for the current platform it is running on. The same approach works for other cryptographic primitives likeECDsa
,Aes
, etc.