You might want to check the permissions on the MachineKeys directory (%SystemDrive%\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys) against this KB article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;278381 Regards, William D. Bartholomew On Mon, 1 Nov 2004 06:24:48 -0500, dave <[EMAIL PROTECTED]> wrote: > Hi all, > I'm using the RSACryptoServiceProvider and am getting the dreaded > > "System.Security.Cryptography.CryptographicException: CryptoAPI > cryptographic > service provider (CSP) for this implementation could not be acquired." > > It seems like this exception is common, but no real answer for it. I've > coded for 3 different scenarios, so *hopefully* I can add additional code > block for anymore > Here's my code. Any suggestions? > > private static RSACryptoServiceProvider AcquireRSA() > { > RSACryptoServiceProvider rsa = null; > try > { > //first try with a container name, works in most ASP.NET situations > CspParameters cspParams = new CspParameters(); > cspParams.KeyContainerName = BuildKeyContainerName(); > cspParams.Flags = CspProviderFlags.UseMachineKeyStore; > rsa = new RSACryptoServiceProvider( cspParams ); > } > catch > { > try > { > //try without a container name (works on XP ) > CspParameters cspParams = new CspParameters(); > cspParams.Flags = CspProviderFlags.UseMachineKeyStore; > rsa = new RSACryptoServiceProvider( cspParams ); > } > catch > { > //just try without any parameters: works for logged on user > rsa = new RSACryptoServiceProvider( ); > } > } > > return rsa; > } > > Thanks, > Dave > > =================================== > This list is hosted by DevelopMentor� http://www.develop.com > Some .NET courses you may be interested in: > > Essential .NET: building applications and components with C# > November 29 - December 3, in Los Angeles > http://www.develop.com/courses/edotnet > > View archives and manage your subscription(s) at http://discuss.develop.com > -- Regards, William D. Bartholomew http://blog.bartholomew.id.au/ =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com
