RSACryptoServiceProvider

Discussion in 'ASP.NET 2.0' started by MCPNS, Apr 3, 2008.

  1. I'm trying to run one of my webservices that uses cryptography but I keep getting the following error message:


    The system cannot find the file specified.

    at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
    at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
    at System.Security.Cryptography.RSA.FromXmlString(String xmlString)


    The code that produces this is nothing more than:




    RSACryptoServiceProvider rsaLicence = new RSACryptoServiceProvider(1024);


    rsaLicence.FromXmlString(<some string>);


    This works fine on my local machine so I'm guessing that there someis something wrong with my configuration but don't know where to start looking.
     
  2. I've had a very speedy reply from Lukas (DiscountASP technical) who has put me on the right track.

    The solution is very simple and is to set


    RSACryptoServiceProvider.UseMachineKeyStore = true;


    Thanks Lukas
     
  3. Awesome. Thanks for posting the solution. [​IMG]
     

Share This Page