YungBlood
15 years agoStreaming Star
Encryption questions **Suspected Bug**
Hey,
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:
Here's the command I run from my linux web server & it's response:
And here is my code:
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.
Ideas anyone?
-Kevin
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:
Hello World!
This is a test of BrightScript encryption...
I hope I can get it to work!
-Kevin
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
key=7B1CB530521E7554D623E1412A2CF29F
iv =785BC65A9D7850FD
And here is my code:
html = CreateObject("roUrlTransfer")
ba = CreateObject("roByteArray")
result = CreateObject("roByteArray")
html.SetUrl("http://myserver.com/roku/test.txt")
test = html.GetToString()
html.SetUrl("http://myserver.com/roku/test.b64")
b64 = html.GetToString()
print b64
print test
ba.fromBase64String(b64)
' ba.fromAsciiString(test)
enc = CreateObject("roEVPCipher")
ret = enc.Setup(false, "bf", "7B1CB530521E7554D623E1412A2CF29F", "785BC65A9D7850FD", 1)
print ret
result = enc.Process(ba)
if result <> invalid then
print result.toAsciiString()
' print result.toBase64String()
else
print "Invalid"
end if
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.
Ideas anyone?
-Kevin