Existe um limite para expoentes de chave RSA no .NET?
Usando C #, não posso importar uma chave pública RSA com um expoente de {1, 0, 0, 0, 15}: Há uma exceção:
System.Security.Cryptography.CryptographicException was caught
HResult=-2146893819
Message=Bad Data.
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& hKey)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at TestRSA.Form1.buttonTest_Click(Object sender, EventArgs e) in c:\Users\Thomas\Documents\Visual Studio 2010\Projects\Modules\TestRSA\Form1.cs:line 32
Código usado:
RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider();
RSAParameters key = new RSAParameters();
key.Exponent = new byte[5] { 1, 0, 0, 0, 15 };
key.Modulus = GetModulus(); // byte Array with length 256...
rsaAlg.ImportParameters(key); // <<== this call will throw the exception
Existe um limite para expoentes de chave RSA no .NET? (Com o expoente == {1, 0, 1}, a importação será bem-sucedida.
Atenciosamente Thomas