DECRYPTION ERROR

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
drOrganized
Posts: 24
Joined: Tue Dec 04, 2007 7:02 pm

DECRYPTION ERROR

Post by drOrganized » Sat Aug 29, 2009 11:30 pm

I AM USING THE COMMAND:

decrypt input using "aes-128-cbc" with "1111"

It works fine. However, if I write encrypted text to a text file called dest and then:

open file dest
read from file until ""
put it into input
close file dest
decrypt input using "aes-128-cbc" with "1111"

Then I get an error on the decrypt command: bad decrypt

WHY SHOULD WRITING AND THEN READING ENCRYPTED CONTENT TO A TEXT FILE GENERATE AN ERROR ON DECRYPTION?

I'M PERPLEXED
Last edited by drOrganized on Sun Aug 30, 2009 12:03 am, edited 1 time in total.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sat Aug 29, 2009 11:46 pm

I think the first thing you should do, is fix your keyboard (Especially the caps-lock key).

Some cyphers expect data to be a certain length, and use padding on the input data to get to that length. If you just feed such a cypher "dummy" data, you need to make sure it's the expected length for that cypher.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

drOrganized
Posts: 24
Joined: Tue Dec 04, 2007 7:02 pm

Post by drOrganized » Sun Aug 30, 2009 12:08 am

BvG wrote:I think the first thing you should do, is fix your keyboard (Especially the caps-lock key).

Some cyphers expect data to be a certain length, and use padding on the input data to get to that length. If you just feed such a cypher "dummy" data, you need to make sure it's the expected length for that cypher.
OK, can you help me a little more as this is not well covered in Revolutions documentation. How can I understand whether my data is the right length for the cypher? Can you suggest a cypher that is less stringent?

Thanks!

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

Post by Mark » Sun Aug 30, 2009 3:41 am

Orgy,

You should also read in the docs about the read command. You're doing it wrong.

Also, there is no need to write subjects with ALL CAPS, but BvG wrote that already.

Best regards,

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

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Sat Sep 05, 2009 2:54 pm

You should probably use:

open file myFile for binary read


The 'binary' keyword lets the engine know that it should not do any translation of line endings and so-on as it would with a text file.

Best,

Mark Smith

Post Reply