org.jsslutils.sslcontext.keymanagers
Class FixedServerAliasKeyManager

java.lang.Object
  extended by org.jsslutils.sslcontext.keymanagers.FixedServerAliasKeyManager
All Implemented Interfaces:
KeyManager, X509KeyManager

public class FixedServerAliasKeyManager
extends Object
implements X509KeyManager

This is an X509KeyManager that will always choose the server alias name it has been constructed with.

Author:
Bruno Harbulot.

Nested Class Summary
static class FixedServerAliasKeyManager.Wrapper
          Wrapper factory class that wraps existing X509KeyManagers into FixedServerAliasKeyManager, with the alias passed to the constructor.
 
Constructor Summary
FixedServerAliasKeyManager(X509KeyManager keyManager, String alias)
          Creates a new instance from an existing X509KeyManager.
 
Method Summary
 String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
          Relays the call to the wrapped X509KeyManager.
 String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
          Returns the alias this instance has been constructed with, regardless of any other parameters.
 X509Certificate[] getCertificateChain(String alias)
          Relays the call to the wrapped X509KeyManager.
 String[] getClientAliases(String keyType, Principal[] issuers)
          Relays the call to the wrapped X509KeyManager.
 PrivateKey getPrivateKey(String alias)
          Relays the call to the wrapped X509KeyManager.
 String[] getServerAliases(String keyType, Principal[] issuers)
          Relays the call to the wrapped X509KeyManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedServerAliasKeyManager

public FixedServerAliasKeyManager(X509KeyManager keyManager,
                                  String alias)
Creates a new instance from an existing X509KeyManager.

Parameters:
keyManager - X509KeyManager to wrap.
alias - alias to use to choose a key for the server sockets.
Method Detail

chooseClientAlias

public String chooseClientAlias(String[] keyType,
                                Principal[] issuers,
                                Socket socket)
Relays the call to the wrapped X509KeyManager.

Specified by:
chooseClientAlias in interface X509KeyManager
See Also:
X509KeyManager.chooseClientAlias(java.lang.String[], java.security.Principal[], java.net.Socket)

chooseServerAlias

public String chooseServerAlias(String keyType,
                                Principal[] issuers,
                                Socket socket)
Returns the alias this instance has been constructed with, regardless of any other parameters.

Specified by:
chooseServerAlias in interface X509KeyManager
Returns:
The alias passed to the constructor.
See Also:
X509KeyManager.chooseServerAlias(java.lang.String, java.security.Principal[], java.net.Socket)

getCertificateChain

public X509Certificate[] getCertificateChain(String alias)
Relays the call to the wrapped X509KeyManager.

Specified by:
getCertificateChain in interface X509KeyManager
See Also:
X509KeyManager.getCertificateChain(java.lang.String)

getClientAliases

public String[] getClientAliases(String keyType,
                                 Principal[] issuers)
Relays the call to the wrapped X509KeyManager.

Specified by:
getClientAliases in interface X509KeyManager
See Also:
X509KeyManager.getClientAliases(java.lang.String, java.security.Principal[])

getPrivateKey

public PrivateKey getPrivateKey(String alias)
Relays the call to the wrapped X509KeyManager.

Specified by:
getPrivateKey in interface X509KeyManager
See Also:
X509KeyManager.getPrivateKey(java.lang.String)

getServerAliases

public String[] getServerAliases(String keyType,
                                 Principal[] issuers)
Relays the call to the wrapped X509KeyManager.

Specified by:
getServerAliases in interface X509KeyManager
See Also:
X509KeyManager.getServerAliases(java.lang.String, java.security.Principal[])


Copyright © 2012. All Rights Reserved.