I was using below code for encryption in my project and everything was working fine.
RSACryptoServiceProvider x_alg = new RSACryptoServiceProvider( );
// e
The problem that you have is that the XML that your customer has given you is not in the format required to deserialize to an object of type RSAParameters
I've run this code to show what the XML generated by the XML serializer looks like
var provider = new RSACryptoServiceProvider();
var parameters = provider.ExportParameters(true);
var x = new XmlSerializer(parameters.GetType());
x.Serialize(Console.Out, parameters);
Console.WriteLine();
The output that it generates is something like:
AQAB
ruCEpD3XnR...g/waE=
90amUU3dDazsqN9+...jJUQ==
tQv5hGehNLLmv4aC...NfUQ==
azJiiZ6itPoBQph...zBcQ==
OmewiOw9bxi/o82...f44Q==
wNohk0NNl...YDg==
fNOOWp46FckcvtI+...PpXAE=
where the ... is truncated output. What your customer has supplied looks like a superset of that (key, text and cipher are not in the parameter list) but the format is a bit different.
You can either ask them to supply the data in exactly the required format then serialize from that; or you can accept their format, deserialize it to XML and build the RSAParameters
object manually by mapping the XML content to the appropriate fields on the RSAParameters
object. You also need to work out what it is that they want to do with the key, text and cipher data as these will be lost in this process.