.tlsinit Method
Function: |
For the currently selected socket (selection is made through sock.num), initializes all resources required for establishing a TLS connection. |
Syntax: |
sock.tlsinit(offset as dword) as enum |
Returns: |
|
See Also: |
Transport Layer Security (TLS), Establishing a Secure Connection, Obtaining Encryption Certificate |
Part |
Description |
offset |
Offset of the certificate file included in the compiled binary of your project. The offset is obtained by using the romfile.offset read-only property. |
Details
This method initializes the certificate authority (CA) — based on the certificate included in the project as a resource file — and the TLS context for the selected socket. If 0 is passed as the value of offset, sock.tlsinit will skip the verification of the certificate.
If sock.tlsinit is called after TLS has already been initialized on the current socket (sock.tlscurrentnum = sock.num), it will return PL_TLS_REJECTED. If called after TLS has already been initialized on a different socket (sock.num <> sock.tlscurrentnum), it will return PL_TLS_ERROR_IN_USE.
PL_TLS_ERROR_CERT will be returned if the certificate can't be parsed because it is not an X.509 certificate or because is uses an unsupported cypher suite.
On the TPP2(G2), TPP3(G2), EM2000, and EM2001, PL_TLS_ERROR_NO_BUFF will be returned if your code does not allocate the required number of buffer pages via the sock.tlsbuffrq method.
Contact Tibbo Support if you ever see the PL_TLS_ERROR_INTERNAL error.