22.10.2013 Views

System i: Programming Secure Sockets APIs - IBM

System i: Programming Secure Sockets APIs - IBM

System i: Programming Secure Sockets APIs - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

#include <br />

#include <br />

/* bufferLen is 250 bytes */<br />

#define bufferLen 250<br />

void main()<br />

{<br />

int bufferLen, on = 1, rc = 0, sd, sd2, addrlen = 0;<br />

char buffer[bufferLen];<br />

}<br />

SSLInit sslinit;<br />

SSLHandle* sslh;<br />

struct sockaddr_in addr;<br />

unsigned short int cipher[3] = {<br />

SSL_RSA_WITH_RC4_128_MD5,<br />

SSL_RSA_WITH_RC4_128_SHA,<br />

SSL_RSA_EXPORT_WITH_RC4_40_MD5<br />

};<br />

/*************************************************/<br />

/* memset sslinit structure to hex zeros and */<br />

/* fill in values for the sslinit structure */<br />

/*************************************************/<br />

memset((char *)&SSL_Init, 0x00, sizeof(sslinit));<br />

sslinit.keyringFileName = "/keyringfile.kyr";<br />

sslinit.keyringPassword = NULL;<br />

sslinit.cipherSuiteList = &cipher[0];<br />

sslinit.cipherSuiteListLen = 3;<br />

/*************************************************/<br />

/* initialize SSL security call SSL_Init */<br />

/*************************************************/<br />

if ((rc = SSL_Init(&sslinit)) != 0)<br />

{<br />

SSL_Perror(rc, "Could not initialize SSL");<br />

}<br />

...<br />

API introduced: V5R1<br />

Top | UNIX-Type <strong>APIs</strong> | <strong>APIs</strong> by category<br />

SSL_Read()—Receive Data from an SSL-Enabled Socket Descriptor<br />

Syntax<br />

#include <br />

int SSL_Read(SSLHandle *handle,<br />

void *buffer,<br />

int buffer_length)<br />

Service Program Name: QSOSSLSR<br />

Default Public Authority: *USE<br />

Threadsafe: Yes<br />

The SSL_Read() function is used by a program to receive data from an SSL-enabled socket descriptor.<br />

<strong>Secure</strong> <strong>Sockets</strong> <strong>APIs</strong> 91

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!