org.jcoderz.commons.connector.http.transport
Class HttpsKeyManager

java.lang.Object
  extended by org.jcoderz.commons.connector.http.transport.HttpsKeyManager
All Implemented Interfaces:
KeyManager, X509KeyManager

public class HttpsKeyManager
extends Object
implements X509KeyManager

This class implements the X509KeyManager interface and allows to select a specific key for client authentification.


Constructor Summary
HttpsKeyManager(X509KeyManager parent, KeyStore keystore, String keyAlias, String keyPassword)
          Constructor.
 
Method Summary
 String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
          
 String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
          
 X509Certificate[] getCertificateChain(String alias)
          Gets the Certificate chain for a particular alias.
 String[] getClientAliases(String keyType, Principal[] issuers)
          Gets the one alias set in constructor.
 PrivateKey getPrivateKey(String alias)
          Gets the Private Key for a particular alias.
 String[] getServerAliases(String keyType, Principal[] issuers)
          Gets the list of server aliases for the SSLServerSockets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpsKeyManager

public HttpsKeyManager(X509KeyManager parent,
                       KeyStore keystore,
                       String keyAlias,
                       String keyPassword)
Constructor.

Parameters:
parent - the parent X509KeyManager
keystore - the KeyStore we derive our client certs and keys from
keyAlias - the alias for key in use
keyPassword - the password used for alias
Method Detail

getClientAliases

public String[] getClientAliases(String keyType,
                                 Principal[] issuers)
Gets the one alias set in constructor. Currently, keyType and issuers are both ignored.

Specified by:
getClientAliases in interface X509KeyManager
Parameters:
keyType - the type of private key the server expects (RSA, DSA, etc.)
issuers - the CA certificates we are narrowing our selection on.
Returns:
the ClientAliases value

getServerAliases

public String[] getServerAliases(String keyType,
                                 Principal[] issuers)
Gets the list of server aliases for the SSLServerSockets.

Specified by:
getServerAliases in interface X509KeyManager
Parameters:
keyType - the type of private key the server expects (RSA, DSA, etc.)
issuers - the CA certificates we are narrowing our selection on.
Returns:
the ServerAliases value

getCertificateChain

public X509Certificate[] getCertificateChain(String alias)
Gets the Certificate chain for a particular alias.

Specified by:
getCertificateChain in interface X509KeyManager
Parameters:
alias - the client alias
Returns:
the CertificateChain value

getPrivateKey

public PrivateKey getPrivateKey(String alias)
Gets the Private Key for a particular alias.

Specified by:
getPrivateKey in interface X509KeyManager
Parameters:
alias - the client alias
Returns:
the PrivateKey value

chooseClientAlias

public String chooseClientAlias(String[] keyType,
                                Principal[] issuers,
                                Socket socket)

Specified by:
chooseClientAlias in interface X509KeyManager

chooseServerAlias

public String chooseServerAlias(String keyType,
                                Principal[] issuers,
                                Socket socket)

Specified by:
chooseServerAlias in interface X509KeyManager


Copyright 2007 The jCoderZ Project.