encrypt and decrypt on iOS

Mike Kerner MikeKerner at roadrunner.com
Sat Apr 26 09:52:58 EDT 2014


Jim,

There are two ways to do encryption on ios in LC:
1) Monte has an encryption external in his mergEXT suite
2) You can use the native code.  The native code uses OpenSSL.  Due to some
technical issues it CAN be less secure than the libraries that Monte is
using, but that is something for you to decide.

You should also encode the encrypted data (AFTER encryption) to ensure that
it transports properly.

The syntax looks like this, assuming:
* The data you want to encrypt is in "what"
* The cipher you want to use is aes-256
* The key you want to use to do the encryption is in "theKey"


encrypt what using "aes-256-cbc" with theKey
put base64encode(it) into what #v. 1.6 was bit16


>From here you would either embed "what" into an email or write to a file
and attach the file.


If it was me, and I was helping you, I would suggest that you do not send
email from ios, but that you use dropbox, because if you send email, your
user will get a chance to see the email and thus screw something up, maybe
by sending the encrypted data to somewhere else, or if you are directly
embedding the "what" container in an email, by accidentally deleting or
adding a character, or maybe a helpful introduction like "Here's the
email", which will screw up your decryption, of course.

Dropbox integration is fairly straightforward.  Monte has a couple of
externals in the mergEXT suite, and there is also an open-source library
that several of us have worked on that works (but it is arguably not as
fast as Monte's external, because it relies on Dropbox's REST API, so your
app will, in effect, have to sit there while the file(s) transfer).



On Sat, Apr 26, 2014 at 3:16 AM, Jim sims <sims at ezpzapps.com> wrote:

> Am trying to figure out how to use the new Encrypt/Decrypt with iOS.
>
> I want to encrypt a few hundred words of data then send as a file
> attachment via email. I have zero idea what PEM format and such are.
>
> Anyone have a stack that shows how this is done?
>
> Would be great to have example stacks for new commands and features when
> new versions come out.
>
> sims
> _______________________________________________
> 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
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list