I have problems with my application. I use the assembly "org.mentalis.security" to create a certificate object from the "pfx" file, this is the line of code where the exception occurs:
Certificate cert = Certificate.CreateFromPfxFile(publicKey, certificatePassword);
It always worked and still works in production, but for some reason it throws an exception when running on Windows 7 (tried on two machines).
CertificateException :
Unable to import the PFX file! [error code = -2146893792]
I cannot find much in this post through Google, but when checking the Event Viewer I get an “audit audit” 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.
<BR>
Cryptographic Operation:
Operation: Open Key.
Return Code: 0x2
I'm not sure why this does not work on Win 7, I never had a problem when I worked with Vista with this. I am using VS2008 as an administrator, but I assume that perhaps the ASP.NET user does not have sufficient privileges or anything else.
, "" " ".
- ?