Page 1 of 1

Encrypt Socket communication

Posted: Thu Jun 25, 2020 9:29 pm
by ace16vitamine
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

Re: Encrypt Socket communication

Posted: Thu Jun 25, 2020 11:34 pm
by FourthWorld
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.

Re: Encrypt Socket communication

Posted: Fri Jun 26, 2020 12:59 am
by ace16vitamine
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

Re: Encrypt Socket communication

Posted: Fri Jun 26, 2020 5:34 am
by FourthWorld
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?

Re: Encrypt Socket communication

Posted: Fri Jun 26, 2020 9:47 am
by ace16vitamine
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