Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CryptIt

0.00/5 (No votes)
7 May 2000 1  
Keep sensitive data safe via encryption
  • Download source files - 129 Kb
  • Sample Image - CryptIt.gif

    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.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here