Need a Windows Crypto API (advapi) based en-de component to run under classic ASP

Hello all,
I'm looking to do password based en-decryption on text strings in a classic ASP/VBScript environment. It's gotta use the Windows Crypto API. Something that will work like this:

myObject = Server.CreateObject("some.component")
pt = "Hellow world"
pw = "007"
ct = myObject.encrypt(pt,pw)
pt = myObject.decrypt(ct,pw)

I'll take VB code and wrap it myself or a compiled dll ready to register on the server. 500 points cause I need it yesterday!!!

Thanks,
ak
enigmediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SweatCoderCommented:
Public Function Encrypt(StrText)
    Dim providers As clsProviders
   
    Dim byteIn() As Byte, byteOut() As Byte
    Dim bytePassword() As Byte
   
    byteIn = Encoder.stringToByteArray(StrText & vbNullChar)
    bytePassword = Encoder.stringToByteArray(PDOXHashPWD & vbNullChar)
   
    Set providers = New clsProviders
   
    Call providers.Item(PROVIDER_ID).Acquire(Flags:=CRYPT_VERIFYCONTEXT)
   
    Dim hashEncrypt As clsHash
    Set hashEncrypt = providers.Item(PROVIDER_ID).CreateHash(32771)
    Call hashEncrypt.AddData(bytePassword)
   
    Dim Key As New clsKey
    Call Key.Derive(hashEncrypt, 26115)
   
    Set hashEncrypt = Nothing
   
    byteOut = Key.Encrypt(byteIn)
    'Set Key = Nothing 'this creates errors
   
    Encrypt = Encoder.ByteArrayToHexString(byteOut)
End Function
Public Function Decrypt(StrText)
    Dim providers As clsProviders
   
    Dim byteIn() As Byte, byteOut() As Byte
    Dim bytePassword() As Byte
   
    byteIn = Encoder.stringToByteArray(StrText & vbNullChar)
    bytePassword = Encoder.stringToByteArray(PDOXHashPWD & vbNullChar)
   
    Set providers = New clsProviders
   
    PROVIDER_ID = 6
    Call providers.Item(PROVIDER_ID).Acquire(Flags:=CRYPT_VERIFYCONTEXT)
   
    Dim hashEncrypt As clsHash
    Set hashEncrypt = providers.Item(PROVIDER_ID).CreateHash(32771)
    Call hashEncrypt.AddData(bytePassword)
   
    Dim Key As New clsKey
    Call Key.Derive(hashEncrypt, 26115)
   
    Set hashEncrypt = Nothing
   
    byteOut = Key.Encrypt(byteIn)
    Set Key = Nothing
   
    Decrypt = Encoder.byteArrayToString(byteOut)
End Function

[there's lots more code. i will have to email the rest. i can't post 1000's of lines here, it's too much.]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SweatCoderCommented:
I will email the full code.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.