Encrypt Socket communication

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: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
ace16vitamine
Posts: 77
Joined: Fri Apr 13, 2018 1:53 pm

Encrypt Socket communication

Post by ace16vitamine » Thu Jun 25, 2020 9:29 pm

Dear all,

I have a working multi Platform application:

Android (open socket) <-> Windows (accept communication) <-> Windows (open socket)

All three systems can communicate with a normal TCP Socket connection to the server in the middle. There I receive read and write request and store infomations in a database.

But what can I do to encrypt the complete TCP traffic?

Android <- read/write encrypt -> Windows <-read/write encrypt -> Windows

I think that I have to include the openSSL Library on all three systems and that I have to create a certificate on the middle server - Right? And then? I can not find documentation about this...

Regs
Stef

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7724
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Encrypt Socket communication

Post by FourthWorld » Thu Jun 25, 2020 11:34 pm

See the "secure" option for the "open socket" command, e.g. "open secure socket to...":
https://livecode.com/resources/api/#liv ... pen_socket

That said, unless you absolutely need a custom protocol you may find use HTTPS simpler for a great many tasks.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

ace16vitamine
Posts: 77
Joined: Fri Apr 13, 2018 1:53 pm

Re: Encrypt Socket communication

Post by ace16vitamine » Fri Jun 26, 2020 12:59 am

Hi Richard,

I have installed a Lets encrypt certificate on the Server in the middle
Remember:

Android (open socket) <-> Windows w. Certificate (accept communication) <-> Windows (open socket)

I start from the Mobile Device (left) the communication:

Code: Select all


 put "myhost.de:9999" into sock_server 
 open secure socket to sock_server with message "wasConnected" without verification
 
And then I receive a Timeout... I dont know why.. :cry:
Can it be that there is also a secure necessary in the write command??

Code: Select all

write var_username & "$*$" & var_passwort & "$*$***EOL" to socket sock_server

btw, I am working with Sockets because I dont know how to work with https :-p maybe if you can give me a short starting point how to send/receive with https it is possible to change this in my application

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7724
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Encrypt Socket communication

Post by FourthWorld » Fri Jun 26, 2020 5:34 am

ace16vitamine wrote:
Fri Jun 26, 2020 12:59 am
btw, I am working with Sockets because I dont know how to work with https :-p maybe if you can give me a short starting point how to send/receive with https it is possible to change this in my application
I'm having a mad love affair with HTTP lately, so you caught me in the right mood for that. :)

Let's begin at the beginning: what's on the server that you're looking to deliver to your app?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

ace16vitamine
Posts: 77
Joined: Fri Apr 13, 2018 1:53 pm

Re: Encrypt Socket communication

Post by ace16vitamine » Fri Jun 26, 2020 9:47 am

Only informations out of a database. We convert this into JSON Format and transfer it over socket.

Today the Socket communication is

A= Android
B=Win Server in the middle
C=Win Server right


C -> B Authentication
B -> C Result of Authentication
C -> B Send extract from his own DB with JSON format
-----
A -> B Authentication
B -> A Result of Authentication
B -> A Send extract from DB with JSON format

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”