Thanks for your help, that works. Wouldn't it be a good idea to change the constructor of the lib to adapt this behaviour? At my customers site we had two users experiencing this problem (indeed, it is a user problem, not a computer problem). Two out of 180 makes me believing that this problem is not only mine...
Kind regards Matthias > -----Original Message----- > From: Milan Tomic [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 18, 2005 1:03 PM > To: security-dev@xml.apache.org > Subject: RE: Problem with WinCAPICryptoProvider > > > > In the constructor of WinCAPICryptoProvider, the first call > > to CryptAcquiryContext fails with NTE_BAD_KEYSET. After that, > > the constructor tries to create one with NEW_KEYSET, which > > fails with NTE_EXISTS. (?????) > > Keys are corrupted. > > After you receive NTE_BAD_KEYSET for the first call to > CryptAcquireContext, try calling CryptAcquireContext using > CRYPT_DELETEKEYSET (to delete the unusable key set if it actually > exists), and then call CryptAcquireContext using CRYPT_NEWKEYSET. > > Hope it helps, > Milan >