Encryption / Encoding Differences between IDE and OS X Standalone
Peter W A Wood
peterwawood at gmail.com
Sat Feb 22 05:54:45 EST 2014
Many thanks to Roger Eller, Jan Schenkel, Bill Vlahos and Paul Hibbert (off list) for helping me identify and workaround the issues I encountered.
Paul pointed out three things: I didn't the use "the text of Field ..."; how to overcome not being able to copy text from a field in an OS X standalone; and the final problem that was related to script local variables.
Using "the text of Field ..." instead of "Field ..." helped to more accurately copy and paste data. (I ended up displaying the encrypted data in Hex anyway.)
I had found that I couldn't copy from a Field in an OS X standalone. Paul provide a script with group handlers to get around the problem. I have submitted a bug report which has been accepted - http://quality.runrev.com/show_bug.cgi?id=11830
At this stage, I was still getting inconsistent results when encrypting data in the IDE or a standalone. Then Paul noticed how I was initialising the encryption parameters, namely the script local variables tPassword, tSalt, tIV:
openStack
put "" into Field "Encrypted"
put "12345678123456781234567812345678" into tPassword
put "12345678123456781234567812345678" into tSalt
put "12345678123456781234567812345678" into tIV
end openStack
on encryptMSG
...
end encryptMSG
on decryptMSG
...
end decryptMSG
He changed this to re-setting the three script local fields each time they were used:
on openStack
put "" into Field "Encrypted"
end openStack
command setPassCodes
put "12345678123456781234567812345678" into tPassword
put "12345678123456781234567812345678" into tSalt
put "12345678123456781234567812345678" into tIV
end setPassCodes
on encryptMSG
setPassCodes
...
end encryptMSG
on decryptMSG
setPassCodes
...
end decryptMSG
After making this change, I now get identical results when encrypting data with the stack in the IDE or as a standalone.
I have also entered a bug report for this - http://quality.runrev.com/show_bug.cgi?id=11832 - I feel there is a bug but not in the encrypt/decrypt functions, it's in the handling of script local variables.
Once again, thanks for all the help.
Kind regards
Peter
http://LiveCode1001.blogspot.com
More information about the use-livecode
mailing list