CryptIt






4.11/5 (3 votes)
May 8, 2000

100631

1367
Keep sensitive data safe via encryption
I saw an article (April 1999 - VCJ) by Kurtz, and wrote a simple ATL DLL to use it in an ASP page. I just wanted to show a number of ways (examples) on how to implement it. This article has 4 projects: ATL (the DLL), VC++ (using the DLL), VB (using the DLL), and ASP (using the DLL)
This was all his code (ARACrypt.cpp/h) and I just used his Class to play.
Note: I did find something funny in the VB example. When I ran it on WinNT, the Decryption didn't seem to
work correctly (see comments in VB code). When I returned encryption data into the text field (Text1.Text)
the Decryption would be wrong (some characters). Once I had the returned encryption data go into a
String
variable it all worked well (see VB code below). When on the Win2000 OS it worked fine the other way...go
figure? Of course I fixed it, but check it out if you have two Operating Systems (WinNT/Win2000).
Option Explicit ' MUST be registered Dim CryptTest As CRYPTITLib.Cryptor Private Sub Command1_Click() Set CryptTest = New CRYPTITLib.Cryptor CryptTest.PassPhrase = Text1.Text CryptTest.StringToCrypt = Text2.Text CryptTest.DoCrypting ' Normally I would not store to a string ' variable, update the text control, then ' use the variable to set the property (below) ' but WinNT 4.0 (SP3)/VB 6.0 (SP3) environment I get ' the wrong decryption...go figure? Try it: ' ' Text3.Text = CryptTest.ReturnCrypted ' ' CryptTest.StringToCrypt = Text3.Text ' ' The above does work on Win2000/VB 6.0 (SP3)!!! ' ' again, "go figure!" ' Dim strTest As String strTest = CryptTest.ReturnCrypted Text3.Text = strTest CryptTest.StringToCrypt = strTest CryptTest.DoCrypting Text4.Text = CryptTest.ReturnCrypted Set CryptTest = Nothing End Sub
I hope that others find this useful.