Has anyone played much with encryption of files? I'm having success on my test file, but a failure on my actual file... I've been experimenting on this for 2 days...
Here is my test file:
This is a test of BrightScript encryption...
I hope I can get it to work!
Here's the command I run from my linux web server & it's response:
-bash-3.1$ openssl bf -a -A -in test.txt -out test.b64 -k RokuRocks -nosalt -p
And here is my code:
html = CreateObject("roUrlTransfer")
ba = CreateObject("roByteArray")
result = CreateObject("roByteArray")
test = html.GetToString()
b64 = html.GetToString()
enc = CreateObject("roEVPCipher")
ret = enc.Setup(false, "bf", "7B1CB530521E7554D623E1412A2CF29F", "785BC65A9D7850FD", 1)
result = enc.Process(ba)
if result <> invalid then
' print result.toBase64String()
Running that works perfectly both ways, setup for encryption or decryption.
When I run it with my real file, I have problems. Encryption works, and appears to match. (*EDIT* I added code, and confirmed an exact match on encrypting.) Yet decryption fails, and simply prints "Invalid". I don't know if it makes any difference, but the real file is a .brs script. Also, the real file is 745 bytes, and the real encrypted file is 1004 bytes.