I have a web (online) asp/vbscript that uses a function to decrypt RC4 encrypted data. A client now needs to email encrypted data and decrypt it on their local desktop. I recently found out about hta's and they appear to be the answer in this case. I have read several posts and downloaded and searched the Scripting guys articles but cannot get the function to work.
I have tried at least thirty variations of the code below without success. I think I need help converting the function to a sub I can call like this: Sub B1_onClick
B1 being the name of the submit button
Here is what I have, and of course I am getting two errors, Wrong number of arguements or invalid property assignment: RC4 and Cannot use parentheses when calling a sub. Any help would be greatly appreciated.
If you can get me going in the right direction I would appreciate it, I feel like I am running in circles here.
I have tried at least thirty variations of the code below without success. I think I need help converting the function to a sub I can call like this: Sub B1_onClick
B1 being the name of the submit button
Here is what I have, and of course I am getting two errors, Wrong number of arguements or invalid property assignment: RC4 and Cannot use parentheses when calling a sub. Any help would be greatly appreciated.
Code:
<html>
<head><title>Data Decryption</title>
<HTA:APPLICATION ID="oHTA";
APPLICATIONNAME="Data Decryption";
BORDER="thin";
BORDERSTYLE="normal";
SINGLEINSTANCE="no";
/>
<style>
body {
background-color:#E8E8E8;
font:13px "Century Gothic";
color:#000;
hr {
color:#0000C0;
.title {
font-weight:700;
</style>
<script type="text/vbscript">
Sub Window_OnLoad
self.resizeTo 600, 400
End Sub
Function RC4(ByRef Key, ByRef Data)
dim KeyBytes(255)
dim CypherBytes(255)
KeyLen=Len(Key)
if KeyLen=0 Then Exit function
KeyText=Key
For i=0 To 255
KeyBytes(i)=Asc(Mid(Key, ((i) Mod (KeyLen))+1, 1))
Next
if Len(Data)=0 Then Exit function
For i=0 To 255
CypherBytes(i)=i
Next
Jump=0 'Swap values of Cypher around based on index and KeyText value
For i=0 To 255 'Find index To switch
Jump=(Jump+CypherBytes(i)+KeyBytes(i)) Mod 256
Tmp=CypherBytes(i) 'Swap
CypherBytes(i)=CypherBytes(Jump)
CypherBytes(Jump)=Tmp
Next
i=0
Jump=0
For X=1 To Len(Data)
i=(i+1) Mod 256
Jump=(Jump+CypherBytes(i)) Mod 256
T=(CypherBytes(i)+CypherBytes(Jump)) Mod 256
Tmp=CypherBytes(i) 'Swap
CypherBytes(i)=CypherBytes(Jump)
CypherBytes(Jump)=Tmp
RC4=RC4 & Chr(Asc(Mid(Data, X, 1)) Xor CypherBytes(T)) 'Character Encryption
Next
End function
Output.innerHTML= RC4
</script>
</head>
<body>
<p><span class="title">Data Decryption Utility</span><hr><br>
<form name="form1" >
<p>Encrypted Data Here: <input type="text" size="40" name="t2">
<input type="hidden" size="40" name="t1" value="36yj49x6t5hd7x245k8tm7829a4d6cvhsh4x1m5r">
<input type="submit" name="B1" value="Submit" onclick="RC4(t2.value,t1.value)"></p><br>
</form>
<div id=Output></div>
</body>
</html>
If you can get me going in the right direction I would appreciate it, I feel like I am running in circles here.