News  [SoftwareSite

Latest News
Older News
RSS Feed
Complete Projects
Useful Classes
Top Downloads
Message Board
Send Comments
Software License Buttons
Forums -> Security Services for .NET 2.0 Forum
CryptographicException: Couldn\'t acquire crypto service provider context.


by Daniel Schealler [daniel dot schealler at flowsoftware dot co dot nz]
posted on 2009/09/23

Hey all. I\'m having troubles.

CryptographicException: Couldn\'t acquire crypto service provider context.

at Org.Mentalis.SecurityServices.Cryptography.CryptoHandle.CreateInternalHandle(IntPtr handle, String container)
at ORG.Mentalis.SecurityServices.Cryptography.CryptoHandle.get_Handle()
at Org.Mentalis.SecurityServices.Cryptography.RC4CryptoServiceProvider.ctor()
at <place in my app where I try to create the RC4 CryptoServiceProvider>

I had to copy that exception trace by hand, from a screenshot sent to me by a client.

Essentially, I have created a .NET 3.5 WinForms application for XP that uses the RC4CryptoServiceProvider to load encrypted user details from an .ini file on startup. It\'s worked fine for months.

About a week ago, I got this exact exception message on my computer. I did some hunting online, but couldn\'t find much - everything I found was related to websites.

I eventually stumbled on a workaround that got things working on my computer. When I deleted the files from the following three folders:

C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\MachineKeys
C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\<token>\\
C:\\Documents and Settings\\Daniel\\Application Data\\Microsoft\\Crypto\\RSA\\<token>\\

The problem went away. The folders re-populated with new information the next time I ran the application.

I had thought this was just something unique to my own development environment - that I had downloaded something weird that corrupted my cryptographic files and folders. It\'s not a field in which I am an expert - I just use the component, and it Just Works. Well... Up until now.

The problem is, one of my company\'s clients has just recently started experiencing the same error, and I\'m not comfortable asking them to just clear out their Crypto files without being able to justify why. Also, it would seem that this wasn\'t due to something odd that I downloaded, as this exception is arising on a series of commercial Terminal Servers.

I\'ve been looking around for support on this issue, but I\'m not having much luck. I\'ll keep looking around. Can anyone out there shed some light on the situation?

Thanks for your time.


Copyright © 2002-2007, The Team. All rights reserved.
This site is located at
Send comments to the webmaster.