I have a problem to set modulus parameter in RSAParameter. I convert my public key string in byte array and my problem is that the lenght is too long.
byte[] lExponent = { 1, 0, 1 };
//Create a new instance of the RSACryptoServiceProvider class.
RSACryptoServiceProvider lRSA = new RSACryptoServiceProvider();
//Create a new instance of the RSAParameters structure.
RSAParameters lRSAKeyInfo = new RSAParameters();
//Set RSAKeyInfo to the public key values.
string KeyString = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV/eUrmhIZul32nN41sF0y/k4detUxPTQngHFQGOoQNCRa84+2mGdCAg3EN9DPsUtCSHjscfp5xC9otgZsj13Rn7atbGZhJn5eZpIzPZV/psfeueL0Idq7b1msyBNG8dqR0WblYvzSY8uWwIIWyOkrQvtUwHJoxrBD4iLO/NEvzQIDAQAB";
PublicKey = Convert.FromBase64String(KeyString);
lRSAKeyInfo.Modulus = PublicKey;
lRSAKeyInfo.Exponent = lExponent;
lRSA.ImportParameters(lRSAKeyInfo);
return Convert.ToBase64String(lRSA.Encrypt(InputStringbytes, false));
The problim is that my key size is 1296 and not 1024. I have tested with XMLParameter string but I have the same problem.
I need help. Thanks per advance