ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/sslmcode.htm

82 lines
5.8 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="task" />
<meta name="DC.Title" content="Change your Java code to use secure sockets layer" />
<meta name="DC.Relation" scheme="URI" content="usessl.htm" />
<meta name="DC.Relation" scheme="URI" content="sslprepf.htm" />
<meta name="DC.Relation" scheme="URI" content="sslsfact.htm" />
<meta name="DC.Relation" scheme="URI" content="ssldecdc.htm" />
<meta name="DC.Relation" scheme="URI" content="sslusedc.htm" />
<meta name="DC.Relation" scheme="URI" content="sslcex04.htm" />
<meta name="DC.Relation" scheme="URI" content="sslcex02.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="sslmcode" />
<meta name="DC.Language" content="en-us" />
<!-- 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. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Change your Java code to use secure sockets layer</title>
</head>
<body id="sslmcode"><a name="sslmcode"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Change your Java code to use secure sockets layer</h1>
<div><div class="section"><p>If your code already uses socket factories to create its sockets,
then you can add secure socket layer (SSL) support to your program. If your
code does not already use socket factories, see <a href="sslsfact.htm">Change
your Java™ code
to use socket factories</a>.</p>
<p>To change your code to use SSL, perform
the following steps:</p>
</div>
<ol><li class="stepexpand"><span>Import javax.net.ssl.* to add SSL support:</span> <pre>import javax.net.ssl.*;</pre>
</li>
<li class="stepexpand"><span>Declare a SocketFactory by using SSLSocketFactory to initialize
it:</span> <pre>SocketFactory newSF = SSLSocketFactory.getDefault();</pre>
</li>
<li class="stepexpand"><span>Use your new SocketFactory to initialize your sockets the same
way that you used your old SocketFactory: </span> <pre>Socket s = newSF.createSocket(args[0], serverPort);</pre>
</li>
</ol>
<div class="section"><p>Your code now uses SSL support. You do not need to make any other
changes to your code.</p>
<p>See <a href="sslcex02.htm">Examples: Change
your Java client
to use secure sockets layer</a> and <a href="sslcex04.htm">Examples:
Change your Java server to use secure sockets layer</a> for example
code.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="sslcex04.htm">Examples: Change your Java server to use secure sockets layer</a></strong><br />
These examples show you how to change one class, named factorySocketServer, to use secure sockets layer (SSL).</li>
<li class="ulchildlink"><strong><a href="sslcex02.htm">Examples: Change your Java client to use secure sockets layer</a></strong><br />
These examples show you how to change one class, named factorySocketClient, to use secure sockets layer (SSL). The first example shows you the factorySocketClient class not using SSL. The second example shows you the same class, renamed factorySSLSocketClient, using SSL.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="usessl.htm" title="SSL provides a means of authenticating a server and a client to provide privacy and data integrity. All SSL communications begin with a &#34;handshake&#34; between the server and the client. During the handshake, SSL negotiates the cipher suite that the client and server use to communicate with each other. This cipher suite is a combination of the various security features available through SSL. You can only use SSL with J2SDK, version 1.3. You can use the Java Secure Socket Extension (JSSE, version 1.0.8), which is the Java implementation of secure sockets layer (SSL), to make your Java application more secure.">Using SSL (JSSE, version 1.0.8)</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="ssldecdc.htm" title="You should consider several factors when deciding which digital certificate to use. You can use your system's default certificate or you can specify another certificate to use.">Select a digital certificate to use</a></div>
<div><a href="sslusedc.htm" title="To use secure sockets layer (SSL), you must run your Java application using a digital certificate.">Use the digital certificate when you run your Java application</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="sslprepf.htm" title="To prepare your system to use secure sockets layer (SSL), you need to install Licensed Programs. the Digital Certificate Manager LP:">Prepare iSeries server for secure sockets layer support</a></div>
<div><a href="sslsfact.htm" title="To use secure sockets layer (SSL) with your existing code, you must first change your code to use socket factories.">Change your Java code to use socket factories</a></div>
</div>
</div>
</body>
</html>