We have to use RSA signature verification in one of our CRM plugins.
When calling
RSACryptoServiceProvider.FromXmlString
To read the private key, the following Exception is thrown:
Request for the permission of type 'System.Security.Permissions.KeyContainerPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters) at System.Security.Cryptography.RSA.FromXmlString(String xmlString) ...
We already tried to pass minimal CspParameters
to the RSA instance, like this:
var parameters = new CspParameters {Flags = CspProviderFlags.CreateEphemeralKey};
var rsaCryptoServiceProvider = new RSACryptoServiceProvider(KeySize,parameters)
but to no effect.
Has anybody been able to use RSA encryption in a Dynamics CRM Plugin?