I'm working on a JAVA program which makes requests to an asp file and it's working fine.
Now I want to encrypt POST requests, but I need to use the same key for encryption on JAVA and ASP for decrypting correctly (or that's what I think).
How can I generate a key from a String on vbscript? And do I need to custom the IV? I don't know what is that :(
(I never encrypted anything, I'm new to this)
set obj = server.CreateObject("System.Security.Cryptography.RijndaelManaged")
set utf = CreateObject("System.Text.UTF8Encoding")
s="This is a private message"
bytes=utf.GetBytes_4(s)
obj.GenerateKey() 'need to custom this
obj.GenerateIV() 'need to custom this?
set enc=obj.CreateEncryptor()
set dec=obj.CreateDecryptor()
bytec=enc.TransformFinalBlock((bytes),0,lenb(bytes))
sc=utf.GetString((bytec))
response.write sc
byted=dec.TransformFinalBlock((bytec),0,lenb(bytec))
sd=utf.GetString((byted))
response.write sd