ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/sslstrer.htm

226 lines
6.8 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>SSL_Strerror--Retrieve SSL Runtime Error Message API</title>
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Begin Header Records -->
<!-- Created for V5R1 by Chris Gloe -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>SSL_Strerror()--Retrieve SSL Runtime Error Message</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax
<pre>
#include &lt;qsossl.h&gt;
char* SSL_Strerror(int <em>sslreturnvalue</em>,
SSLErrorMsg* <em>serrmsgp</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QSOSSLSR <br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE <br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong><em>SSL_Strerror()</em></strong> function is used to retrieve an
error message and associated text string which describes an SSL return
value.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt>int <strong><em>sslreturnvalue</em></strong> &nbsp;(Input)&nbsp;</dt>
<dd>The Return Value received from a SSL API.<br>
<br>
</dd>
<dt>SSLErrorMsg* <strong><em>serrmsgp</em></strong> &nbsp;(Input)&nbsp;</dt>
<dd>The pointer to a <strong><em>SSLErrorMsg</em></strong> structure. If no
<strong><em>SSLErrorMsg</em></strong> is provided, NULL must be entered.
<strong><em>SSLErrorMsg</em></strong> is a typedef for a buffer of type struct
<strong><em>SSLErrorMsgStr</em></strong>. In <strong>&lt;qsossl.h&gt;</strong>,
struct <strong><em>SSLErrorMsg</em></strong> is defined as the following:
<pre>
struct SSLErrorMsgStr { /* SSLErrorMsgStr */
char messageID[7]; /* Message identifier */
char messageFile[20]; /* Qualified message file name */
};
</pre>
<p>The fields within the <strong><em>SSLErrorMsg</em></strong> structure as
pointed to by <em>serrmsgp</em> are defined as follows:</p>
<dl>
<dt>char <strong><em>messageID[7]</em></strong> (output)</dt>
<dd>The message identifier which defines the message associated with the input
<em>sslreturnvalue</em>.<br>
<br>
</dd>
<dt>char <strong><em>messageFile[20]</em></strong> (output)</dt>
<dd>The fully qualified message file name where the message associated with the
<em>messageID</em> is stored. The first 10 characters specify the file name,
and the second 10 characters specify the library.</dd>
</dl>
</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p>The <em>SSL_Strerror()</em> API returns a pointer to the string. The
null-terminated string is stored in the CCSID of the job. If the
<strong><em>serrmsgp</em></strong> is provided, the
<strong><em>SSLErrorMsg</em></strong> struct will be updated to reflect the
message information corresponding to the string returned.</p>
<br>
<h3>Error Conditions</h3>
<p>If the <strong><em>sslreturnvalue</em></strong> is unrecognized, then an
<strong>Unknown error</strong> message will be stored at the location pointed
to by the return value. Other error conditions will be handled as described
under Error Messages.</p>
<br>
<h3>Error Messages</h3>
<p>This API calls the Retrieve Message (QMHRTVM) API in order to perform its
task. It inherits all error conditions from this function. If errors are
encountered while using the Retrieve Message API, they will be reflected in the
<strong><em>SSLErrorMsg</em></strong> fields (if provided) and any associated
message replacement text will be stored at the location pointed to by the
return value.</p>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="sslperr.htm">SSL_Perror()</a>--Print SSL Error Message<br><br></li>
<li><a href="sslcreat.htm">SSL_Create()</a>--Enable SSL Support for the Specified
Socket Descriptor<br><br></li>
<li><a href="ssldest.htm">SSL_Destroy()</a>--End SSL Support for the Specified SSL
Session<br><br></li>
<li><a href="sslhands.htm">SSL_Handshake()</a>--Initiate the SSL Handshake
Protocol<br><br></li>
<li><a href="sslinit.htm">SSL_Init()</a>--Initialize the Current Job for
SSL<br><br></li>
<li><a href="sslinita.htm">SSL_Init_Application()</a>--Initialize the Current Job
for SSL Processing Based on the Application Identifier<br><br></li>
<li><a href="sslread.htm">SSL_Read(</a>)--Receive Data from an SSL-Enabled Socket
Descriptor<br><br></li>
<li><a href="sslwrite.htm">SSL_Write()</a>--Write Data to an SSL-Enabled Socket
Descriptor</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how <strong>SSL_Strerror()</strong> is used:</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;qsossl.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;errno.h&gt;
/* bufferLen is 250 bytes */
#define bufferLen 250
void main()
{
int bufferLen, on = 1, rc = 0, sd, sd2, addrlen = 0;
char buffer[bufferLen];
SSLInit sslinit;
SSLHandle* sslh;
struct sockaddr_in addr;
unsigned short int cipher[3] = {
SSL_RSA_WITH_RC4_128_MD5,
SSL_RSA_WITH_RC4_128_SHA,
SSL_RSA_EXPORT_WITH_RC4_40_MD5
};
/*************************************************/
/* memset sslinit structure to hex zeros and */
/* fill in values for the sslinit structure */
/*************************************************/
memset((char *)&amp;SSL_Init, 0x00, sizeof(sslinit));
sslinit.keyringFileName = "/keyringfile.kyr";
sslinit.keyringPassword = NULL;
sslinit.cipherSuiteList = &amp;cipher[0];
sslinit.cipherSuiteListLen = 3;
/*************************************************/
/* initialize SSL security call SSL_Init */
/*************************************************/
if ((rc = SSL_Init(&amp;sslinit)) != 0)
{
printf("SSL_Init() failed with rc = %d %s \n"
"and errno = %d %s \n",rc,<strong>SSL_Strerror</strong>(rc, NULL),
errno,strerror(errno));
}
...
}
</pre>
<br>
<hr>
API introduced: V5R1
<hr>
<center>
<table cellpadding="2" cellspacing="2" align="center">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a> </td>
</tr>
</table>
</center>
</body>
</html>