Click here to Skip to main content
15,393,864 members
Articles / Programming Languages / Visual Basic
Posted 7 May 2000


38 bookmarked


Rate me:
Please Sign up or sign in to vote.
4.11/5 (3 votes)
7 May 2000
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
        ' 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
        Text4.Text = CryptTest.ReturnCrypted
        Set CryptTest = Nothing
    End Sub

    I hope that others find this useful.


    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


    About the Author

    Dan Madden
    Product Manager
    Germany Germany
    I have been programming (as a hobby) for 20+ years (Unix C, Scripting, VB, C/C++, C#). I am getting too old to talk about it and been in the Security line of work (both Military/Civilian) for 25+ years.

    Comments and Discussions

    QuestionVC6 - Works Well Except for Memory Leaks Pin
    fwcetus27-Feb-13 11:12
    Memberfwcetus27-Feb-13 11:12 
    GeneralUsing this DLL in C++ Pin
    GauravLa11-Dec-06 20:56
    MemberGauravLa11-Dec-06 20:56 
    AnswerRe: Using this DLL in C++ Pin
    Dan Madden14-Dec-06 2:14
    MemberDan Madden14-Dec-06 2:14 
    Generalsending encripted string via http Pin
    AzerothAr22-May-06 10:09
    MemberAzerothAr22-May-06 10:09 
    Generalw98 Pin
    txemuki20-Jul-05 0:41
    Membertxemuki20-Jul-05 0:41 
    GeneralMother Algorithm Pin
    Omar Malik6-Oct-04 20:41
    MemberOmar Malik6-Oct-04 20:41 
    GeneralRe: Mother Algorithm Pin
    Dan Madden7-Oct-04 3:40
    MemberDan Madden7-Oct-04 3:40 
    Generalno source code provided Pin
    YanivY22-Oct-02 20:02
    MemberYanivY22-Oct-02 20:02 
    GeneralCSP Help Pin
    Niyo17-Jul-01 12:10
    MemberNiyo17-Jul-01 12:10 
    GeneralDoesn't work. Pin
    PeterHarrie14-May-00 23:17
    MemberPeterHarrie14-May-00 23:17 
    GeneralDoesn't work. Pin
    10-Jul-01 2:13
    suss10-Jul-01 2:13 
    GeneralRe: Doesn't work. Pin
    6-Aug-01 9:51
    suss6-Aug-01 9:51 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.