Encryption / Encoding Differences between IDE and OS X Standalone
Jan Schenkel
janschenkel at yahoo.com
Thu Feb 20 00:45:58 EST 2014
Hi Peter,
Fields are meant for the display of text, not binary data.
You could 'base64encode' the binary data before you display it.
Oh, and when treating binary data, you should the 'byte' chunk instead of the 'char' chunk.
That way when LiveCode goes all-in Unicode, your script will continuye to work.
HTH,
Jan Schenkel
=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
--------------------------------------------
On Wed, 2/19/14, Peter W A Wood <peterwawood at gmail.com> wrote:
Subject: Encryption / Encoding Differences between IDE and OS X Standalone
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Date: Wednesday, February 19, 2014, 6:19 PM
I've written a very simple stack to
encrypt or decrypt some text. There are two fields (In and
Out) and two buttons (Encrypt and Decrypt). When I encrypt
test in the IDE and then paste the encrypted text from the
Out field to the In field and then decrypt it, I get the
back the original text. But not in an OS X Standalone. From
a few experiments, I suspect that the issue is related to
displaying the encrypted text, probably an encoding issue.
I'm using LiveCode 6.5.2 under OS X 10.7.5
Here is my script:
local tData
local tDisplay
local tPassword
local tSalt
local tIV
on openStack
put the sha1Digest of "My Old Password"
into tPassword
put "12345678" into tSalt
put "1234567890123456" in tIV
end openStack
on encryptMSG
put Field "In" into tData
encrypt tData using "aes256" with password
tPassword and salt tSalt and IV tIV
put it into tDisplay
delete char 1 to 16 of tDisplay
put tDisplay into Field "Out"
end encryptMSG
on decryptMSG
put Field "In" into tData
decrypt tData using "aes256" with password
tPassword and salt tSalt and IV tIV
put it into Field "Out"
end decryptMSG
When I copy the encrypted text from the OS X standalone into
a text editor (or even Mail), it displays differently (hence
my suspicion that this is an encoding issue.
I appreciate any suggestions as to where I am going wrong.
Thanks
Peter
http://LiveCode1001.blogspot.com
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage
your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list