Encryption woes

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Encryption woes

Post by trenatos » Thu Jul 25, 2013 5:37 am

I'm trying to figure out how to transfer encrypted data to my server, have the server decrypt it and then respond.
I'm using sockets and it's working fine, but I don't understand the encryption system.

Code: Select all

get "textheres"
encrypt it using "aes256" with "passhere"
write it & return to socket "127.0.0.1:2001"
I'm getting random values, which I understand is due to the random salt being added, how can I extract the salt? If the server is to decrypt it, it'll need the salt.
If I specify the salt as below, it uses that salt, and it seems partially visible in cleartext, but again I'm not sure because it's only partially visible, the server still needs to be provided with the salt somehow.

Code: Select all

get "textheres"
encrypt it using "aes256" with "passhere" and salt "saltedhere"
write it & return to socket "127.0.0.1:2001"
The resulting string is this: Salted__saltedheÍ?°ÒôÛOªãßèü´ D
Now, it seems that sometimes the string also contains other characters such as carriage returns and EOL's, and this too has me confused, and that part IS messing with the socket, when it drops a return in the string.

Can someone explain to me what's going on?
Marcus

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Encryption woes

Post by trenatos » Thu Jul 25, 2013 6:54 pm

Reading up on this, it has to do with OpenSSL encrypting with a header.
The first 16 bytes include the header and salt.
The salt is the second set of 8 bytes in the header.

Slowly getting somewhere :)
Marcus

trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Location: Virginia, USA
Contact:

Re: Encryption woes

Post by trenatos » Fri Jul 26, 2013 1:56 am

I think I'm actually just going to write my server in LiveCode as well.

It'll use a MySQL database anyway, so I can easily create a web-based interface if I want to, later on, rather than using the web server by default.

It will also make it easier to distribute the client and server.
Marcus

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”