com.sap.mdm.net
Class MdmSecureSocketFactory

java.lang.Object
  extended byjavax.net.SocketFactory
      extended bycom.sap.mdm.net.MdmSecureSocketFactory

public class MdmSecureSocketFactory
extends SocketFactory

Wrapper class combining SUN and SAP secure socket factory implementations

Since:
7.1.07

Field Summary
static int SSL_TYPE_MUTUAL_AUTHENTICATION
           
static int SSL_TYPE_NONE
           
static int SSL_TYPE_SERVER_AUTHENTICATION
           
 
Method Summary
 Socket createSocket()
           
 Socket createSocket(InetAddress host, int port)
           
 Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
           
 Socket createSocket(String host, int port)
           
 Socket createSocket(String host, int port, InetAddress localHost, int localPort)
           
 boolean equals(Object obj)
           
 KeyStore getKeyStore()
          Returns the key store specified by the user.
static KeyStore getKeyStore(String location, String password)
          Reads the key store from the specified file and returns an instance of KeyStore.
static KeyStore getKeyStore(String location, String password, String type)
          Reads the key store from the specified file of the specified type and returns an instance of KeyStore.
static MdmSecureSocketFactory getSAPImpl(KeyStore serverKeystore)
          Creates an instance of MdmSecureSocketFactory based on the SAP implementation of SecureConnectionFactory class
static MdmSecureSocketFactory getSAPImpl(KeyStore serverKeystore, KeyStore clientKeystore, String keyPassword)
          Creates an instance of MdmSecureSocketFactory based on the SAP implementation of secure socket.
 int getSSLAuthenticationType()
          Returns a SSL authentication type.
static MdmSecureSocketFactory getSUNImpl(KeyStore serverKeystore)
          Creates an instance of MdmSecureSocketFactory based on Sun implementation of SocketFactory interface
static MdmSecureSocketFactory getSUNImpl(KeyStore serverKeystore, KeyStore clientKeystore, String keyPassword)
          Creates an instance of MdmSecureSocketFactory based on the Sun implementation of secure socket.
static MdmSecureSocketFactory getSUNImpl(String serverKeystoreFile, String keystorePassword)
          Creates an instance of MdmSecureSocketFactory based on Sun implementation of SocketFactory interface
 boolean isSAPFactory()
          Indicates if the current instance implements SAP socket factory (SecureSocketFactory class)
 
Methods inherited from class javax.net.SocketFactory
getDefault
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSL_TYPE_NONE

public static final int SSL_TYPE_NONE
See Also:
Constant Field Values

SSL_TYPE_SERVER_AUTHENTICATION

public static final int SSL_TYPE_SERVER_AUTHENTICATION
See Also:
Constant Field Values

SSL_TYPE_MUTUAL_AUTHENTICATION

public static final int SSL_TYPE_MUTUAL_AUTHENTICATION
See Also:
Constant Field Values
Method Detail

getSUNImpl

public static MdmSecureSocketFactory getSUNImpl(KeyStore serverKeystore)
                                         throws MdmSSLException
Creates an instance of MdmSecureSocketFactory based on Sun implementation of SocketFactory interface

Parameters:
serverKeystore - the key store containing the server's public keys
Returns:
instance of MdmSecureSocketFactory
Throws:
MdmSSLException

getSUNImpl

public static MdmSecureSocketFactory getSUNImpl(KeyStore serverKeystore,
                                                KeyStore clientKeystore,
                                                String keyPassword)
                                         throws MdmSSLException
Creates an instance of MdmSecureSocketFactory based on the Sun implementation of secure socket. Connections created by the socket factory are trusted connections.

Parameters:
serverKeystore - the key store containing the server's public keys
clientKeystore - the key store containing the client's key pair used for client authentication
keyPassword - the password to the client's key pair
Returns:
A socket factory
Throws:
MdmSSLException - if it is not possible to create a socket factory
Since:
7.1 SP 08

getSUNImpl

public static MdmSecureSocketFactory getSUNImpl(String serverKeystoreFile,
                                                String keystorePassword)
                                         throws MdmSSLException
Creates an instance of MdmSecureSocketFactory based on Sun implementation of SocketFactory interface

Parameters:
keystorePassword - password to the key store
Returns:
instance of MdmSecureSocketFactory
Throws:
MdmSSLException

getSAPImpl

public static MdmSecureSocketFactory getSAPImpl(KeyStore serverKeystore)
Creates an instance of MdmSecureSocketFactory based on the SAP implementation of SecureConnectionFactory class

Parameters:
serverKeystore - the key store containing the server's public keys
Returns:
instance of MdmSecureSocketFactory
Throws:
MdmSSLException

getSAPImpl

public static MdmSecureSocketFactory getSAPImpl(KeyStore serverKeystore,
                                                KeyStore clientKeystore,
                                                String keyPassword)
Creates an instance of MdmSecureSocketFactory based on the SAP implementation of secure socket. Connections created by the socket factory are trusted connections.

Parameters:
serverKeystore - the key store containing the server's public keys
clientKeystore - the key store containing the client's key pair used for client authentication
keyPassword - the password to the client's key pair
Returns:
A socket factory
Throws:
MdmSSLException - if it is not possible to create a socket factory
Since:
7.1 SP 08

createSocket

public Socket createSocket()
                    throws IOException
Throws:
IOException

createSocket

public Socket createSocket(String host,
                           int port)
                    throws IOException,
                           UnknownHostException
Throws:
IOException
UnknownHostException

createSocket

public Socket createSocket(InetAddress host,
                           int port)
                    throws IOException
Throws:
IOException

createSocket

public Socket createSocket(String host,
                           int port,
                           InetAddress localHost,
                           int localPort)
                    throws IOException,
                           UnknownHostException
Throws:
IOException
UnknownHostException

createSocket

public Socket createSocket(InetAddress address,
                           int port,
                           InetAddress localAddress,
                           int localPort)
                    throws IOException
Throws:
IOException

isSAPFactory

public boolean isSAPFactory()
Indicates if the current instance implements SAP socket factory (SecureSocketFactory class)

Returns:
true if this instance represents SAP socket factory, false otherwise

getKeyStore

public KeyStore getKeyStore()
Returns the key store specified by the user.

Returns:
a key store
Since:
7.1 SP08

getSSLAuthenticationType

public int getSSLAuthenticationType()
Returns a SSL authentication type.

Returns:
the SSL authentication type
Since:
7.1 SP08
See Also:
{@link MdmSecureSocketFactory#SSL_TYPE_SERVER_AUTHENTICATION}, {@link MdmSecureSocketFactory#SSL_TYPE_MUTUAL_AUTHENTICATION}

equals

public boolean equals(Object obj)

getKeyStore

public static KeyStore getKeyStore(String location,
                                   String password)
                            throws MdmSSLException
Reads the key store from the specified file and returns an instance of KeyStore. It is assumed that the file is of the JKS type.

Parameters:
location - the location of the key store file
password - the password for the key store
Returns:
An instance of KeyStore
Throws:
MdmSSLException - if a problem occurs reading the key store
Since:
7.1 SP 08

getKeyStore

public static KeyStore getKeyStore(String location,
                                   String password,
                                   String type)
                            throws MdmSSLException
Reads the key store from the specified file of the specified type and returns an instance of KeyStore.

Parameters:
location - the location of the key store file
password - the password for the key store
type - the key store type ("JKS" or "PKCS12")
Returns:
An instance of KeyStore
Throws:
MdmSSLException - if a problem occurs reading the key store
Since:
7.1 SP 08


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.