CryptographicException: Key not valid for use in specified state
- From: SimonDev <SimonDev@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Jun 2007 20:56:01 -0700
Hi
I'm using the RSACryptoServiceProvider to encrypt and decrypt passwords.
The key is stored as an XML string and I use the
RSACryptoServiceProvider.FromXmlString method to read it.
I've used the same class successfully in several applications over several
months. However, in the last week it has given me problems. I'm getting the
CryptographicException "Key not valid for use in specified state" when the
FromXmlString method runs.
Does anyone have any idea as to what causes this exception message?
The key that is stored as XML hasn't changed since the last time the
application worked. The problem appears to be related to the user account
the application is running under. The application can run as either a
Windows Forms app or a Windows service. It runs fine when I run it as a
Windows Forms app. However, it throws the exception when it runs as a
Windows service under the local service account. If I run it as a Windows
service under my account it works fine.
The problem only occurs on versions of the application I have built in the
last week. If I install the application using an old MSI file it runs fine.
If I run the app's setup project (in Visual Studio) to create a new MSI file
then install the app using that new MSI file I get the exception when I run
it as a Windows service.
As the problem seems to be related to the account the Windows service is
running under I assume the problem is to do with permissions. Since it was
never a problem until a week ago I assume the system admins have made some
change. Unfortunately I haven't been able to find an admin who admits to
making any change (I worded this carefully as there are system admins in 3
cities who could have done it and I can't track them all down).
If I can go to the system admins with a definite (or even a probable) cause
I hope I can convince them to take the problem seriously and help me work out
a solution.
Cheers
Simon
.
- Prev by Date: Re: Automating the roll-out of permission sets & code groups
- Next by Date: Re: Implement "run as" for application within application....
- Previous by thread: Re: .Net 2.0
- Next by thread: Re: Implement "run as" for application within application....
- Index(es):
Relevant Pages
|