certificate issues running app in windows 7 ?

Posted by Jurjen on Stack Overflow See other posts from Stack Overflow or by Jurjen
Published on 2010-04-18T16:38:33Z Indexed on 2010/04/18 16:43 UTC
Read the original article Hit count: 475

Filed under:
|
|

Hi,

I'm having some problems with my App. I'm using 'org.mentalis.security' assembly to create a certificate object from a 'pfx' file, this is the line of code where the exception occurs :

Certificate cert = Certificate.CreateFromPfxFile(publicKey, certificatePassword);

this has always worked and still does in production, but for some reason it throws an exception when run in windows 7 (tried it on 2 machines).

CertificateException : Unable to import the PFX file! [error code = -2146893792]

I can't find much on this message via google, but when checking the EventViewer I get an 'Audit Failure' every time this exception occurs:

Event ID = 5061 Source = Microsoft Windows Security Task Category = system Integrity Keywords = Audit Failure

Cryptographic operation.

Subject:
Security ID: NT AUTHORITY\IUSR
Account Name: IUSR
Account Domain: NT AUTHORITY
Logon ID: 0x3e3

Cryptographic Parameters:
Provider Name: Microsoft Software Key Storage Provider
Algorithm Name: Not Available.
Key Name: VriendelijkeNaam
Key Type: User key.

Cryptographic Operation:
Operation: Open Key.
Return Code: 0x2
`

I'm not sure why this isn't working on win 7, I've never had problems when I was running on Vista with this. I am running VS2008 as administrator but I guess that maybe the ASP.NET user doesn't have sufficient rights or something.

It's pretty strangs that the 'Algorithm name' is 'Not Available'

can anyone help me with this...

TIA, Jurjen de Groot

© Stack Overflow or respective owner

Related posts about c#

Related posts about certificate