Type: JadeSSLContext
The sslContext property of the TcpIpConnection class causes the core network facilities to use the SSL instead of TCP/IP protocol when a connection is active.
Asynchronous connection operations are executed on another thread. If this asynchronous worker thread needs to access JADE objects (for example, the TcpIpConnection, JadeSSLContext, and JadeX509Certificate objects), these objects need to be shared transient or persistent objects.
The following example shows the use of the sslContext property to open an outgoing SSL connection.
vars tcpip : TcpIpConnection; sslContext : JadeSSLContext; x509 : JadeX509Certificate; begin create x509 transient; x509.readCertificateDataFromFile("c:\Certificates\client.pem"); x509.readPrivateKeyDataFromFile("c:\Certificates\client.key", "myPassword"); create sslContext transient; sslContext.methodType := JadeSSLContext.MethodTLSv1_2; sslContext.caFile := "c:\Certificates\serverCAcerts.pem"; sslContext.x509 := x509; create tcpip transient; tcpip.name := "mySSLNode"; tcpip.port := 8097; tcpip.sslContext := sslContext; tcpip.open; // ... send and receive some data tcpip.close; epilog delete x509; delete sslContext; delete tcpip; end;
See also the JadeSSLContext and JadeX509Certificate classes, earlier in this chapter.