We help IT Professionals succeed at work.

Basic Cryptographic Services Provider works in Vista/Windows 7 but fails on XP

doraiswamy
doraiswamy asked
on
I created a crypto object using MS Basic Cryptographic Services provider in VS 2008 (C++). It is encrypting and decrypting fine on Vista and Windows 7. However, the same provider does not work on XP. Both encryption and decryption return false, and the GetLastError returns the code 0x80090012.
Comment
Watch Question

Commented:
Make sure the latest .NET framework is installed on the XP machine - I believe it is .NET Framework 3.5 SP1 ??  (Go to http://update.windows.com on the XP machine and look under the "Other" section for this update)


OR download it from the following location:

http://www.microsoft.com/downloads/details.aspx?FamilyID=d0e5dea7-ac26-4ad7-b68c-fe5076bba986&displaylang=en

Commented:
<Just Guessing>I'd be looking to see if the target WinXP machine has the proper Crypto API DLL files.  I'd consider installing the CAPICON redistributable to see if that helps</Just Guessing>
http://www.microsoft.com/downloads/details.aspx?FamilyID=860EE43A-A843-462F-ABB5-FF88EA5896F6&displaylang=en 
Hi. I am able to double-encrypt the string (i.e. encrypt it twice in succession) in WIndows 7, but XP throws the error that the string is already encrypted/decrypted. To overcome this problem, instead of immediately re-encrypting the string, I am encrypting the whole file in one pass and then re-encrypting it in the second pass with another cryptographic object.

This solves the problem (for now at least).

Commented:
That sounds more like a coding issue...   We'd be happy to take a look at your code