Interface SecureConnection

All Superinterfaces:
javax.microedition.io.Connection, javax.microedition.io.InputConnection, javax.microedition.io.OutputConnection, SocketConnection, javax.microedition.io.StreamConnection

public interface SecureConnection
extends SocketConnection

This interface defines the secure socket stream connection. A secure connection is established using Connector.open with the scheme "ssl" and the secure connection is established before open returns. If the secure connection cannot be established due to errors related to certificates a CertificateException is thrown.

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 or IPv6 number. e.g. ssl://host.com:79 defines a target socket on the host.com system at port 79.

Note that [RFC1900] recommends the use of names rather than IP numbers for best results in the event of IP number reassignment.

The SSL V3 protocol as specified in The SSL Protocol Version 3.0 MUST be supported as the secure protocol. An implementation that supports TLS v1.0 and supports section E of [RFC2246] (to provide backwards compatibility with SSL v3.0 servers) is compliant with this requirement. Other secure protocols, such as TLS Protocols Version 1.0 as specified in [RFC2246] and WAP(TM) TLS Profile and Tunneling Specification as specified in WAP-219-TLS-20010411-a, MAY also be supported.

BNF Format for Connector.open() string

The URI must conform to the BNF syntax specified below. If the URI does not conform to this syntax, an IllegalArgumentException is thrown.

<socket_connection_string> ::= "ssl://"<hostport>
<hostport> ::= host ":" port
<host> ::= host name or IP address
<port> ::= numeric port number


The following examples show how a SecureConnection would be used to access a sample loopback program.

 SecureConnection sc = (SecureConnection) Connector.open("ssl://host.com:79");
 SecurityInfo info = sc.getSecurityInfo(); boolean isTLS =
 sc.setSocketOption(SocketConnection.LINGER, 5);
 InputStream is = sc.openInputStream(); OutputStream os =
 os.write("\r\n".getBytes()); int ch = 0; while(ch != -1) { ch = is.read(); }
 is.close(); os.close(); sc.close();

MIDP 2.0

Field Summary
Fields inherited from interface javax.microedition.io.SocketConnection
Method Summary
 SecurityInfo getSecurityInfo()
          Return the security information associated with this connection when it was opened.
Methods inherited from interface javax.microedition.io.SocketConnection
getAddress, getLocalAddress, getLocalPort, getPort, getSocketOption, setSocketOption
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream, openInputStream
Methods inherited from interface javax.microedition.io.Connection
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream, openOutputStream
Methods inherited from interface javax.microedition.io.Connection

Method Detail


SecurityInfo getSecurityInfo()
                             throws java.io.IOException
Return the security information associated with this connection when it was opened.

the security information associated with this open connection.
java.io.IOException - if an arbitrary connection failure occurs


Send a comment or suggestionVersion 3.0 of Mobile Information Device Profile Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-2009 Motorola Inc. Portions copyright 1993-2002 Sun Microsystems, Inc. and Motorola, Inc. All Rights Reserved.