📄 secureconnection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Fri Sep 27 14:47:30 CDT 2002 --><TITLE>Mobile Information Device Profile 2.0: Interface SecureConnection</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecureConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><strong>MIDP 2.0</strong></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <B>PREV CLASS</B> <A HREF="../../../javax/microedition/io/SecurityInfo.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SecureConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.microedition.io</FONT><BR>Interface SecureConnection</H2><DL><DT><B>All Superinterfaces:</B> <DD>Connection, InputConnection, OutputConnection, <A HREF="../../../javax/microedition/io/SocketConnection.html">SocketConnection</A>, StreamConnection</DD></DL><HR><DL><DT>public interface <B>SecureConnection</B><DT>extends <A HREF="../../../javax/microedition/io/SocketConnection.html">SocketConnection</A></DL><P>This interface defines the secure socket stream connection. A secure connection is established using <CODE>Connector.open</CODE> with the scheme "ssl" and the secure connection is established before <CODE>open</CODE> returns. If the secure connection cannot be established due to errors related to certificates a <CODE>CertificateException</CODE> is thrown. <P> A secure socket is accessed using a generic connection string with an explicit host and port number. The host may be specified as a fully qualified host name or IPv4 number. e.g. <code>ssl://host.com:79</code> defines a target socket on the <code>host.com</code> system at port <code>79</code>. <P>Note that RFC1900 recommends the use of names rather than IP numbers for best results in the event of IP number reassignment. </P> <P> A secure connection MUST be implemented by one or more of the following specifications: <UL> <LI>TLS Protocol Version 1.0 as specified in <A HREF="http://www.ietf.org/rfc/rfc2246.txt">RFC 2246</A>. </LI> <LI>SSL V3 as specified in <A HREF="http://home.netscape.com/eng/ssl3/draft302.txt"> The SSL Protocol Version 3.0</A> </LI> <LI>WAP(TM) TLS Profile and Tunneling Specification as specified in <A HREF="http://www.wapforum.com/what/technical.htm"> WAP-219-TLS-20010411-a</A> </LI> </UL> <H2> BNF Format for Connector.open() string </H2> <P> The URI must conform to the BNF syntax specified below. If the URI does not conform to this syntax, an <code>IllegalArgumentException</code> is thrown. </P> <TABLE BORDER="1"> <TR> <TD><socket_connection_string> </TD> <TD>::= "<strong>ssl://</strong>"<hostport> </TD> </TR> <TR> <TD><hostport> </TD> <TD>::= <I>host</I> ":" <I>port </I> </TD> </TR> <TR> <TD><host> </TD> <TD>::= <I>host name or IP address </I> </TD> </TR> <TR> <TD><port> </TD> <TD>::= <I>numeric port number </I> </TD> </TR> </TABLE> <H2> Examples </H2> <P> The following examples show how a <code>SecureConnection</code> would be used to access a sample loopback program. </P> <PRE> SecureConnection sc = (SecureConnection) Connector.open("ssl://host.com:79"); SecurityInfo info = sc.getSecurityInfo(); boolean isTLS = (info.getProtocolName().equals("TLS")); sc.setSocketOption(SocketConnection.LINGER, 5); InputStream is = sc.openInputStream(); OutputStream os = sc.openOutputStream(); os.write("\r\n".getBytes()); int ch = 0; while(ch != -1) { ch = is.read(); } is.close(); os.close(); sc.close(); </PRE><P><DL><DT><B>Since: </B><DD>MIDP 2.0</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_javax.microedition.io.SocketConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface javax.microedition.io.<A HREF="../../../javax/microedition/io/SocketConnection.html">SocketConnection</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/microedition/io/SocketConnection.html#DELAY">DELAY</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#KEEPALIVE">KEEPALIVE</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#LINGER">LINGER</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#RCVBUF">RCVBUF</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#SNDBUF">SNDBUF</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/microedition/io/SecurityInfo.html">SecurityInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/microedition/io/SecureConnection.html#getSecurityInfo()">getSecurityInfo</A></B>()</CODE><BR> Return the security information associated with this connection when it was opened.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.microedition.io.SocketConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.microedition.io.<A HREF="../../../javax/microedition/io/SocketConnection.html">SocketConnection</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/microedition/io/SocketConnection.html#getAddress()">getAddress</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#getLocalAddress()">getLocalAddress</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#getLocalPort()">getLocalPort</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#getPort()">getPort</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#getSocketOption(byte)">getSocketOption</A>, <A HREF="../../../javax/microedition/io/SocketConnection.html#setSocketOption(byte, int)">setSocketOption</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.microedition.io.InputConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.microedition.io.InputConnection</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>openDataInputStream, openInputStream</CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.microedition.io.Connection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.microedition.io.Connection</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>close</CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.microedition.io.OutputConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.microedition.io.OutputConnection</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>openDataOutputStream, openOutputStream</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getSecurityInfo()"><!-- --></A><H3>getSecurityInfo</H3><PRE>public <A HREF="../../../javax/microedition/io/SecurityInfo.html">SecurityInfo</A> <B>getSecurityInfo</B>() throws java.io.IOException</PRE><DL><DD>Return the security information associated with this connection when it was opened.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the security information associated with this open connection.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an arbitrary connection failure occurs</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecureConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><strong>MIDP 2.0</strong></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <B>PREV CLASS</B> <A HREF="../../../javax/microedition/io/SecurityInfo.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SecureConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="mailto:jsr-118-comments@jcp.org">Send a comment or suggestion</a> Version 2.0 of Mobile Information Device Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright 1993-2002 Sun Microsystems, Inc. and Motorola, Inc. All Rights Reserved. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -