This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine.SSLSocket Class

Inherits from: Socket

SSLSocket Class

Enums

SSL_HANDSHAKE#

NameDescription
ERROR_NONE = 0The TLS/SSL I/O operation completed.
ERROR_SSL = 1A non-recoverable, fatal error in the SSL library occurred, usually a protocol error. The OpenSSL error queue contains more information on the error. If this error occurs then no further I/O operations should be performed on the connection.
ERROR_WANT_READ = 2Error code returned when the last operation was a read operation from a nonblocking BIO. It means that not enough data was available at this time to complete the operation. If at a later time the underlying BIO has data available for reading the same function can be called again.
ERROR_WANT_WRITE = 3Error code returned when the last operation was a write to a nonblocking BIO and it was unable to sent all data to the BIO. When the BIO is writable again, the same function can be called again.
ERROR_WANT_X509_LOOKUP = 4The operation did not complete because an application callback has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.
ERROR_SYSCALL = 5Some non-recoverable, fatal I/O error occurred. The OpenSSL error queue may contain more information on the error. For socket I/O on Unix systems, consult errno for details. If this error occurs then no further I/O operations should be performed on the connection.
ERROR_ZERO_RETURN = 6The TLS/SSL peer has closed the connection for writing by sending the close_notify alert. No more data can be read. Note that SSL_ERROR_ZERO_RETURN does not necessarily indicate that the underlying transport has been closed.
ERROR_WANT_CONNECT = 7The operation did not complete; the same TLS/SSL I/O function should be called again later. The underlying BIO was not connected yet to the peer and the call would block in connect(). The SSL function should be called again when the connection is established.
ERROR_WANT_ACCEPT = 8The operation did not complete; the same TLS/SSL I/O function should be called again later. The underlying BIO was not connected yet to the peer and the call would block in accept(). The SSL function should be called again when the connection is established.
ERROR_WANT_ASYNC = 9The operation did not complete because an asynchronous engine is still processing data. The TLS/SSL I/O function should be called again later. The function must be called from the same thread that the original call was made from.
ERROR_WANT_ASYNC_JOB = 10The asynchronous job could not be started because there were no async jobs available in the pool. The application should retry the operation after a currently executing asynchronous operation for the current thread has completed.
ERROR_WANT_CLIENT_HELLO_CB = 11The operation did not complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.
OK = 100Hadnshake operation was successful.
FAILED = 101Hadnshake operation failed.

SSL_CTX_METHOD#

NameDescription
TLS = 0General-purpose version-flexible SSL/TLS methods. The actual protocol version used will be negotiated to the highest version mutually supported by the client and the server. Currently supported protocols are TLS 1.0, TLS 1.1, and TLS 1.2.
TLS_1_0 = 1Transport Layer Security Version 1.0 protocol.
TLS_1_1 = 2Transport Layer Security Version 1.1 protocol.
TLS_1_2 = 3Transport Layer Security Version 1.2 protocol.
DTLS = 4Version-flexible DTLS methods. Currently supported protocols are DTLS 1.0 and DTLS 1.2.
DTLS_1 = 5Datagram Transport Layer Security Version 1.0 protocol.
DTLS_1_2 = 6Datagram Transport Layer Security Version 1.2 protocol.

LOADER_TYPE#

NameDescription
RSA_KEY = 3RSA key.
X509_CERT = 1Self-signed X.509 certificate.
X509_CACERT = 2X.509 certificate issued by a Certification Agency.

Properties

bool IsAvailable#

The value indicating if the socket is available (has been established, but not opened).

bool IsCertificateVerified#

The value indicating if SSL certificate for the socket is successfully verified.

Members


SSLSocket ( ) #

Constructor. Creates a new SSL socket with default parameters (TLS).

SSLSocket ( Socket.SOCKET_TYPE socket_type, SSLSocket.SSL_CTX_METHOD ssl_method ) #

Constructor. Creates a new SSL socket with the specified parameters.

Arguments

void Close ( ) #

Closes the socket.

bool Accept ( Socket socket ) #

Accepts a connection on the socket.

Arguments

  • Socket socket - Socket that is bound to an address and listens to connections.

Return value

true if the connection is accepted; otherwise, fals.

bool Connect ( ) #

Initiates a connection on the socket.

Return value

true if the connection is initialized; otherwise, false.

bool Load ( SSLSocket.LOADER_TYPE loader_type, string path ) #

Loads a certificate from the file.

Arguments

Return value

true if the certificate is loaded successfully, otherwise false.

bool Parse ( SSLSocket.LOADER_TYPE loader_type, string data ) #

Parses a specified certificate.

Arguments

Return value

true if the certificate is parsed successfully, otherwise false.

SSLSocket.SSL_HANDSHAKE Handshake ( ) #

Starts a handshake and returns the result.

Return value

Handshake status.

int Pending ( ) #

Returns the number of bytes available for immediate retrieval without reading from the socket object. This function is essential if you work with event loops.

Return value

Number of bytes.

uint Read ( IntPtr ptr, uint size, uint nmemb ) #

Reads the specified number of blocks of the specified size from the SSL connection to the specified destination buffer.

Arguments

  • IntPtr ptr - Pointer to the destination buffer to which the data is to be read.
  • uint size - Size of a message block in bytes.
  • uint nmemb - Number of message blocks to read from the SSL connection.

Return value

Number of bytes actually read.

uint Write ( IntPtr ptr, uint size, uint nmemb ) #

Writes the specified number of blocks of the specified size from the specified source buffer to the SSL connection.

Arguments

  • IntPtr ptr - Pointer to the source buffer from which the data is to be written.
  • uint size - Size of a message block in bytes.
  • uint nmemb - Number of message blocks to be written to the SSL connection.

Return value

Number of bytes actually written.

uint Peek ( IntPtr ptr, uint size, uint nmemb ) #

Reads the specified number of blocks of the specified size from the SSL connection to the specified destination buffer. This method is identical to Read() except no bytes are actually removed from the underlying BIO during the read, so that a subsequent call to Read() will yield at least the same bytes.

Arguments

  • IntPtr ptr - Pointer to the destination buffer to which the data is to be read.
  • uint size - Size of a message block in bytes.
  • uint nmemb - Number of message blocks to be written to the SSL connection.

Return value

Number of bytes actually written.
Last update: 2023-11-30
Build: ()