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

315 lines
7.5 KiB
HTML

<!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>gsk_environment_init()--Initialize an SSL environment</title>
<!-- Begin Header Records -->
<!-- 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. -->
<!-- Change History: -->
<!-- Created for V5R1 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- End Header Records -->
<!--Java sync-link-->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>gsk_environment_init()--Initialize an SSL environment</h2>
<div class="box" style="width: 80%;">
<br>
<p>&nbsp;&nbsp;Syntax</p>
<pre>
#include &lt;gskssl.h&gt;
int gsk_environment_init(gsk_handle <em>my_env_handle</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QSYS/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>gsk_environment_init()</strong> function is used to initialize
the SSL environment after any required attributes are set. The certificate
store file is opened and other operations such as accessing information in the
registration facility are performed to set up this environment. After this
function call is issued, SSL is ready to process secure session requests.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>my_env_handle</strong>&nbsp;(Input)&nbsp;</dt>
<dd>The handle identifying the SSL environment that will be initialized.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>Authorization of *R (allow access to the object) to the certificate store
file and its associated files is required. Authorization of *X (allow use of
the object) to each directory of the path name of the certificate store file
and its associated files is required.</p>
<br>
<h3>Return Value</h3>
<p><strong>gsk_environment_init()</strong> returns an integer. Possible values
are:</p>
<dl>
<dt><em>[GSK_OK]</em></dt>
<dd><p><strong>gsk_environment_init()</strong> was successful.</p>
</dd>
<dt><em>[GSK_INVALID_HANDLE]</em></dt>
<dd><p>The handle specified was not valid.</p>
</dd>
<dt><em>[GSK_INVALID_STATE]</em></dt>
<dd><p>A <strong>gsk_environment_init()</strong> has already been issued with this
handle.</p>
</dd>
<dt><em>[GSK_KEYRING_OPEN_ERROR]</em></dt>
<dd><p>Certificate store file could not be opened.</p>
</dd>
<dt><em>[GSK_AS400_ERROR_NO_ACCESS]</em></dt>
<dd><p>No permission to access the certificate store file.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_V3_CIPHER]</em></dt>
<dd><p>An SSLV3 or TLSV1 cipher suite was specified that is not valid.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_V2_CIPHER]</em></dt>
<dd><p>An SSLV2 cipher suite was specified that is not valid.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_CERTIFICATE]</em></dt>
<dd><p>The certificate is bad.</p>
</dd>
<dt><em>[GSK_ERROR_NO_PRIVATE_KEY]</em></dt>
<dd><p>There is no private key associated with the certificate.</p>
</dd>
<dt><em>[GSK_AS400_ERROR_PASSWORD_EXPIRED]</em></dt>
<dd><p>The validity time period of the certificate store file password has
expired.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_KEYFILE_LABEL]</em></dt>
<dd><p>The specified certificate store's certificate label is not valid or does
not exist.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_KEYFILE_PASSWORD]</em></dt>
<dd><p>The specified certificate store password is not valid.</p>
</dd>
<dt><em>[GSK_NO_KEYFILE_PASSWORD]</em></dt>
<dd><p>No certificate store password was specified.</p>
</dd>
<dt><em>[GSK_AS400_ERROR_NOT_REGISTERED]</em></dt>
<dd><p>The application identifier has not been registered.</p>
</dd>
<dt><em>[GSK_AS400_ERROR_INVALID_POINTER]</em></dt>
<dd><p><em>my_env_handle</em> pointer is not valid.</p>
</dd>
<dt><em>[GSK_ERROR_BAD_KEY_LEN_FOR_EXPORT]</em></dt>
<dd><p>The certificate was created with a key length that cannot be exported.</p>
</dd>
<dt><em>[GSK_INSUFFICIENT_STORAGE]</em></dt>
<dd><p>Not able to allocate storage for the requested operation.</p>
</dd>
<dt><em>[GSK_INTERNAL_ERROR]</em></dt>
<dd><p>An unexpected error occurred during SSL processing.</p>
</dd>
<dt><em>[GSK_ERROR_IO]</em></dt>
<dd><p>An error occurred in SSL processing, check <em>errno</em> value.</p></dd>
</dl>
<br>
<h3>Error Conditions</h3>
<p>When the <strong>gsk_environment_init()</strong> API fails with return code
[GSK_ERROR_IO], <em>errno</em> can be set to:</p>
<dl>
<dt><em>[EINTR]</em></dt>
<dd>Interrupted function call.</p>
</dd>
<dt><em>[EDEADLK]</em></dt>
<dd>Resource deadlock avoided.</p>
</dd>
<dt><em>[ETERM]</em></dt>
<dd>Operation terminated.</p></dd>
</dl>
<br>
<br>
<p>If an <em>errno</em> is returned that is not in this list, look in <a href=
"unix14.htm">Errno Values for UNIX-Type Functions</a> for a description of the
<em>errno</em>.</p>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPE3418 E</td>
<td width="85%" valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td valign="top">CPF9872 E</td>
<td valign="top">Program or service program &amp;1 in library &amp;2 ended.
Reason code &amp;3.</td>
</tr>
<tr>
<td valign="top">CPFA081 E</td>
<td valign="top">Unable to set return value or error code.</td>
</tr>
</table>
<br>
<h3>Usage Notes</h3>
<ol>
<li>If <strong>gsk_environment_init()</strong> fails,
<strong>gsk_environment_close()</strong> must be issued to clean up
resources.<br>
<br>
</li>
<li>Multiple SSL environment handles may be opened in a process with different
attributes set for each SSL environment.<br>
<br>
</li>
<li>The status of the local certificate can be determined by checking the
GSK_CERTIFICATE_VALIDATION_CODE <em>enumId</em> using
<strong>gsk_attribute_get_numeric_value()</strong>. The <em>numValue</em> will
indicate the certificate validation return code for the certificate used on
this <strong>gsk_environment_init()</strong>.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="gsk_attribute_set_buffer.htm">gsk_attribute_set_buffer()</a>--Set
character information for a secure session or an SSL environment.<br>
<br>
</li>
<li><a href="gsk_attribute_set_enum.htm">gsk_attribute_set_enum()</a>--Set
enumerated information for a secure session or an SSL environment.<br>
<br>
</li>
<li><a href=
"gsk_attribute_set_numeric_value.htm">gsk_attribute_set_numeric_value()</a>--Set
numeric information for a secure session or an SSL environment<br>
<br>
</li>
<li><a href="gsk_environment_close.htm">gsk_environment_close()</a>--Close the SSL
environment<br>
<br>
</li>
<li><a href="gsk_environment_open.htm">gsk_environment_open()</a>--Get a handle for
an SSL environment<br>
<br>
</li>
<li><a href="gsk_strerror.htm">gsk_strerror()</a>--Retrieve GSK runtime error
message</li>
</ul>
<br>
<hr>
API introduced: V5R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<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>