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.

}<br />

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

char buffer[bufferLen];<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 />

printf("SSL_Init() failed with rc = %d %s \n"<br />

"and errno = %d %s \n",rc,SSL_Strerror(rc, NULL),<br />

errno,strerror(errno));<br />

}<br />

...<br />

API introduced: V5R1<br />

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

SSL_Write()—Write Data to an SSL-Enabled Socket Descriptor<br />

Syntax<br />

#include <br />

int SSL_Write(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_Write() function is used by a program to write data to an SSL-enabled socket descriptor.<br />

Parameters<br />

SSLHandle* handle (input)<br />

The pointer to an SSLHandle for an SSL session. An SSLHandle is a typedef for a buffer of type<br />

struct SSLHandleStr. In , struct SSLHandleStr is defined as the following:<br />

<strong>Secure</strong> <strong>Sockets</strong> <strong>APIs</strong> 97

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

Saved successfully!

Ooh no, something went wrong!