Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to establish a secure connection by using Synapse?
    text
    copied!<p>I'm testing Synapse and want to know how can I establish a secure connection. I noticed it supports SSL, but I'm not sure whether it suits my needs. I don't have a certificate from CA. I just want to encrypt all data between my server program and client program. Sure, I can encrypt the data myself before sending out. But if SSL can encrypt the data, maybe I can just use it. From what I know, SSL is for "encryption" and "authentication". What I need is only "encryption". Is it possible with Synapse? </p> <p><strong>UPDATE:</strong></p> <p>Thanks for helping from daemon_x and the author of Synapse, Lukas Gebauer, I think I finally make it work. Here are what I did:</p> <p><strong>Server Side</strong>:</p> <p>1) Uses ssl_openssl in your unit and put 'libeay32.dll' and 'ssleay32.dll' to the same directory of the exe file</p> <p>2) After a connection is accepted, add following lines of code for the newly created socket.</p> <pre><code>fclient.SSLAcceptConnection; </code></pre> <p><strong>Client side</strong>: </p> <p>1) Uses ssl_openssl in your unit and put 'libeay32.dll' and 'ssleay32.dll' to the same directory of the exe file</p> <p>2) After connected to the server, add following line.</p> <pre><code>fclient.SSLDoConnect; </code></pre> <p>If no error occurred, the connection is secure now. But when you run your code, as said in document of Synapse, you may notice that the SSLAcceptConnection takes some time to return. So if you want to speed things up, you better create a certificate file and private key file upfront. And add following code before SSLAcceptConnection</p> <pre><code> fclient.SSL.CertificateFile := 'bs-cert'; fclient.SSL.PrivateKeyFile := 'bs-privatekey'; </code></pre> <p>If you don't have a certificate and private key, please refer to "CreateSelfSignedCert" in ssl_openssl for getting a self-signed certificate and private key. You can save, by WriteStrToStream for example, FCertificate and FPrivatekey to files and use them later.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload