Posted by webster
(219.76.96.9) on June 03, 2004 at 15:53:56:
I want to develop an One Time Password system for Client using the blance reader to get the password and login to the ASP server (IIS 5.0). The problem is that the Crypto API not so support in the ASP environment. How to call DES function on the server side ? Here are some source code:
Error Then 'Do error handling here End If MyAes.Mode = 2 'Use CBC mode If 0 Error Then 'Do error handling here End If MyAes.IV = "1234567890123456" 'use this as IV If 0 Error Then 'Do error handling here End If
temp = "" For x = 0 To 31 temp = temp & PlainData(x) & " " Next response.write "Data: " & temp & ""
encData = MyAes.Encrypt(PlainData) tempOutput = "" For x = 0 To 31 tempOutput = tempOutput + encData(x) Next
response.write temp If 0 Error Then 'Do error handling here End If Rem Destroy encryption context and create new decryption context Rem This is necessary iv CBC mode is used to restore original IV Rem or any time you want to use different keys. Set MyAes = nothing
set MyAes = Server.CreateObject("zccryptx.zcAES") MyAes.Key = Key Error = MyAes.LastError If 0 Error Then 'Do error handling here End If MyAes.Mode = 2 'Use CBC mode If 0 Error Then 'Do error handling here End If MyAes.IV = "1234567890123456" 'use this as IV If 0 Error Then 'Do error handling here End If dencdata1 = MyAes.Decrypt(encData) If 0 Error Then 'Do error handling here End If
Rem Now DencData1 should contain same data as PlainData Rem ------ Rem This should do the same without destroying szAES object. Rem Just restore IV to required value. MyAes.IV = "1234567890123456" 'use this as IV If 0 Error Then 'Do error handling here End If DencData2 = MyAes.Decrypt(encData) If 0 Error Then 'Do error handling here End If Rem Now DencData2 should contain same data as PlainData %>
Follow Ups:
|