Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unexpected behavior using Crypto API

Status
Not open for further replies.

sacheson

Programmer
Mar 30, 2000
55
0
0
US
Is anyone here familiar with the CryptoAPI (functionality exposed through Win32 advapi32.dll)? I'm beating my head against the wall on this project, and can't seem to find anyone that has an answer.

Background to the problem: using VB6 (maint on legacy project + dumb constraints == vb6) to encrypt some data. A requirement of the encrypted strings, is every string must encrypt to the same value (basically, if you encrypt "dog" the ciphered text must be the same every time "dog" is encrypted. From what I can tell, CAPICOM uses some time stamp as the seed, deriving a more secure, yet non-static cipher. I can not use the easy, friendly CAPICOM because of this functionality.

Problem: I'm encrypting data on my laptop, running Win XP Pro, SP2, and I am not able to decrypt the data on the database or web servers, both running Win2K. The same happens when I encrypt on the Win2K boxes - I can't decrypt on my WinXp machine, BUT data encrypted on one Win2K box WILL decrypt on either Win2K box.

Question: Does anyone know how I can encrypt my data on one Windows OS and decrypt it on another?

My exposure to crytography is via .Net, with relatively little work with any encryption/decryption in pre-.Net technologies. As I said, some odd constraints prevent me from using .Net, Java or other enterprise level toolset that might limit the problems I am experiencing.

Any insight is appreciated more than you will ever know.

Also, at this point, 3rd party COM compliant tools are a consideration.

Thanks.
Sam
 
It's all smoke and mirrors to me, but we do have a user-defined constant that we pass to the CryptHashData function when we encrypt/decrypt the data. I'm assuming that it somehow forces the same result.
 
thanks for the reply. Yeah, i'm using a static value as a parameter to the CryptHashData function.

I found this article on MSFT's site: Apparently, the lovely giant has changed the way the API works from WinXP SP1 and beyond. There is a required call to CryptSetKeyParam that must be set explicitly to decrypt a value encrypted on Win 2K.

Of course, I can't get it to work. And their sample doesn't work. And it doesn't address the issue of using several different servers, both 2K and 2K3, and XP Pro on workstations with encryption and decryption. Hmmm ... what's that about forced obsolescence?

Think I'm going to jimmy-rig this solution so I can exploit .Net somehow.

______________________________________________
When told, "goto hell", a programmer finds the method, not the destination as harmful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top