title: CryptographicException (The parameter is incorrect) on Windows 8.1 but not Windows 7
body: <p>I have some code that's been working fine on Windows 7 but fails now that I've started using a Windows 8.1 dev box (see repro code below).</p>
  
  <p>Is RSA different on Windows 8.1 vs. Windows 7?</p>
  
  <pre><code>using System.Security.Cryptography;
  using System.Text;
  
  
  namespace RsaBug
  {
      class Program
      {
          static void Main()
          {
              var modulus = Encoding.UTF8.GetBytes("rvco6d27bsw2fw5qx7okdcu5jahd1ifh22is76k5xyau3wjv7plo0rom66h2434tvm29cmq2ov6mbjo30bymb14j2dst5fzy7pd");
              var exponent = Encoding.UTF8.GetBytes("1ekh");
  
              using (var rsa = new RSACryptoServiceProvider())
              {
                  //Get an instance of RSAParameters from ExportParameters function.
                  var rsaKeyInfo = rsa.ExportParameters(false);
  
                  //Set RSAKeyInfo to the public key values. 
                  rsaKeyInfo.Modulus = modulus;
                  rsaKeyInfo.Exponent = exponent;
  
                  //Import key parameters into RSA.
                  rsa.ImportParameters(rsaKeyInfo); // on Windows 8.1, this throws
              }
          }
      }
  }
  </code></pre>
  
  <p>Here's the exception I get:</p>
  
  <pre><code> System.Security.Cryptography.CryptographicException was unhandled
    _HResult=-2147024809
    _message=The parameter is incorrect.
  
    HResult=-2147024809
    IsTransient=false
    Message=The parameter is incorrect.
  
    Source=mscorlib
    StackTrace:
         at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
         at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle&amp; hKey)
         at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
         at RsaBug.Program.Main() in d:\sandbox\2015\RsaBug\RsaBug\Program.cs:line 24
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>