Showing 'Server was unable to process request. ---> Invalid provider type specified.\n' for RSACryptoServiceProvider

140 views Asked by At

I'm using RSA algorithm for encryption and decryption.

X509Certificate2 certificate = new 
X509Certificate2(pfxFilePath,password);
RSACryptoServiceProvider publicKey = (RSACryptoServiceProvider)certificate.PublicKey.Key;

Working properly on local-machine/service but showing Invalid provider type specified.\n' on sever machine.Using same .net framework. How can resolve the issue.

1

There are 1 answers

0
cr7oo On BEST ANSWER

By adding some parameters works in certificate works for me.

X509Certificate2 certificate = new X509Certificate2(pfxFilePath,password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);