Encrypt Decrypt

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Encrypt Decrypt

Post by keyless » Sun Sep 07, 2008 7:55 am

I've seen some examples of using Encrypt and Decrypt for text and data in fields, but have not seen/found anything about Encrypting whole binary files. Anyone have a code example?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Sep 07, 2008 8:49 am

Hi Keyless,

Just read the binary file, put its content into a variable, and encrypt the variable instead of a field. It works exactly the same as the example with the fields.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Sun Sep 07, 2008 5:14 pm

Does this work well with large files?

Would this be as fast as using the actual openSSL program where I could just give it the file path and the destination path and it would encode?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Sep 07, 2008 6:03 pm

Dear Keyless,

How big is big? I've never had any problems encrypting photos of a few megabytes large.

I don't know what "actual OpenSSL programme" you are using, but if you refer to openssl.org, then I can tell you that both OpenSSL and Revolution depend on the same SSLeay, which means that there should hardly be any speed difference.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Sun Sep 07, 2008 6:23 pm

Mark wrote:Dear Keyless,

How big is big? I've never had any problems encrypting photos of a few megabytes large.

I don't know what "actual OpenSSL programme" you are using, but if you refer to openssl.org, then I can tell you that both OpenSSL and Revolution depend on the same SSLeay, which means that there should hardly be any speed difference.

Best,

Mark
I'm talking about DV video files which average about 600megs.

...I'm refering to the OpenSSL command-line executable. I also think it can be done like that with the dll, but the rev implimentation seems to need you to read the file into rev first then encrypt, then write it to a file.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Sep 07, 2008 9:04 pm

Hi Keyless,

Why don't you set up a streaming server with password authentication?

I don't think it makes sense to encrypt an entire 600MB video. Ultimately, it will be decrypted and could be recorded again. Do you know how easy it is to record a computer screen onto a DVD or video recorder?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Sun Sep 07, 2008 10:13 pm

Mark wrote:Hi Keyless,

Why don't you set up a streaming server with password authentication?

I don't think it makes sense to encrypt an entire 600MB video. Ultimately, it will be decrypted and could be recorded again. Do you know how easy it is to record a computer screen onto a DVD or video recorder?

Best,

Mark
Mark, they want it encrypted for secure storage and transfer, they are not looking to make them playable on the web or server or anything. When it is encrypted you can't play it so, it would not be possible for a screen recording.

I makes perfect sense to encrypt it, if you don't want someone to view it.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Sep 07, 2008 10:38 pm

You didn't say what it was for, keyless. Now, I can understand why a streaming server is not what you are looking for.

Are you going to use the OpenSSL command line utility, or are you still looking for a Rev-only solution?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Mon Sep 08, 2008 12:36 am

Mark wrote:You didn't say what it was for, keyless. Now, I can understand why a streaming server is not what you are looking for.

Are you going to use the OpenSSL command line utility, or are you still looking for a Rev-only solution?

Mark
Looking for a rev only solution. OpenSSL command line works fine but I'd rather not have to pass the password/keyphrase to the command line. Doesn't seem as secure as a pass to a DLL.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 08, 2008 7:24 am

Hi Keyless,

You could repeatedly read a small chunk of the movie file, encrypt this and encode it with base64encode before writing it to the destination file. Make sure to use a special item delimiter, which is not used by base64encode, between the chunks. You can experiment with chunk sizes to obtain the highest speed.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Tue Sep 09, 2008 1:18 am

Mark wrote:Hi Keyless,

You could repeatedly read a small chunk of the movie file, encrypt this and encode it with base64encode before writing it to the destination file. Make sure to use a special item delimiter, which is not used by base64encode, between the chunks. You can experiment with chunk sizes to obtain the highest speed.

Best,

Mark
Thats an pretty good idea.

I've finished the program though with a command line Blowfish encryptor I found. For the final production we are going to have a DLL made.

I do like your idea though, and will do some testing with it, might come in handy, Thanks Mark.

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Thu Sep 11, 2008 6:19 am

For future consideration:

Is there more access to the ssl dlls then just the encrypt and decrypt in Rev? can you pass proper openSSL commands and peramiters? -stream & -a would be very helpful.

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm

Post by Bernard » Thu Sep 11, 2008 7:14 am

I believe the only way you can do that is using the 'shell' and 'open process' commands built into rev.

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Sun Sep 14, 2008 1:24 am

Thanks.

It's too bad, the DLL's to do such are right there.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Sun Sep 14, 2008 8:08 am

You could always file an enhancement request at http://quality.runrev.com and ask the Rev team to expose more OpenSSL functions.
Explain what you would like to see extra and give them a compelling business case. Or contact them directly to see how much it would cost to extend if you really need it but it doesn't fit in with their current strategic plan.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply