Zilog EZ80F91AZA User Manual

Page 65

Advertising
background image

UM020107-1211

Creating SSL Applications

ZTP Network Security SSL Plug-In

User Manual

59

2. To receive TCP data over the TCP-SSL connection, the

recv

API is used. For exam-

ple, to receive 10 bytes of TCP data and place the data in a buffer called

MyBuff

, the

following code fragment can be used:

BYTE MyBuff[100];

INT16 Status;

Status = recv( ConnectionDev, MyBuf, 10, 0);

The exact same application is used to receive 10 bytes of data through the SSL layer.

Although the data sent between the client and server SSL layers is encrypted, the data
passed between the ZTP SSL layer and the user application is nonencrypted. Therefore, the
code that retrieves data from the ZTP TCP layer can also be used to retrieve decrypted data
from the ZTP SSL layer without modification.

To send TCP data, the

send

API is used. For example, to send 10 bytes of TCP data

from a buffer called

MyBuff

, the following code fragment is used:

Status = send( ConnectionDev, MyBuf, 10, 0);

The exact same application is used to send 10 bytes through the SSL layer.

3. To close an underlying TCP-SSL connection, the

close_s

API is used, with the

socket of the connection device (used during data transfer) passed as a parameter.

close_s( ConnectionDev );

The exact same

close_s

API is also used to close the SSL session represented by the

SSL connection socket. When it is no longer necessary to maintain the TCP server in a
running condition, the application can close the TCP socket by issuing the

close_s

API and using the TCP socket ID.

close_s( ServerDev );

Again, the exact same

close_s

API is also used to close the SSL server device.

In summary, any ZTP TCP server application is converted to use SSL for secure data
transfer by changing the socket type used. The syntax and semantics of all other data
transfer APIs are identical for both TCP and SSL.

Note:

Advertising
This manual is related to the following products: