We are facing issue specifically in Windows Server 2012 R2.
Below is our demo code:
rsa.ImportParameters(new RSAParameters
{
Exponent = new byte[] { 1, 0, 1 },
Modulus = OurModulus
});
Throws exception like:
Exception Source : mscorlib
Exception Type : CryptographicException
Exception Message : The parameter is incorrect.
Exception Stacktrace :
at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle& hKey)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
This snippet is working fine in Windows 7, Windows 8, Windows 10 but fails in Windows Server 2012 R2.