net.sf.basedb.util.ssl
Class StaticKeyManager
java.lang.Object
net.sf.basedb.util.ssl.StaticKeyManager
- All Implemented Interfaces:
- KeyManager, X509KeyManager
public class StaticKeyManager
- extends Object
- implements X509KeyManager
A key manager implementation that always selects a specified keystore entry.
We use it to make sure that a client certificate that has been registered
with a FileServer
is always selected for authoriation independent of
other settings.
- Since:
- 2.16
- Author:
- Nicklas
- Last modified
- $Date: 2010-06-16 14:28:36 +0200 (Wed, 16 Jun 2010) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
keyStore
private final KeyStore keyStore
alias
private final String alias
password
private final char[] password
StaticKeyManager
public StaticKeyManager(KeyStore keyStore,
String alias,
String password)
throws KeyStoreException
- Create a new key manager
- Parameters:
keyStore
- The key-store containing the client certificatealias
- The alias of the key-store entry to use, or null to use
the first entry in the key-storepassword
- The password that is required to unlock the entry
- Throws:
KeyStoreException
chooseClientAlias
public String chooseClientAlias(String[] keyType,
Principal[] issuers,
Socket socket)
- Specified by:
chooseClientAlias
in interface X509KeyManager
- Returns:
- Always the alias specified in the constructor
chooseServerAlias
public String chooseServerAlias(String keyType,
Principal[] issuers,
Socket socket)
- Specified by:
chooseServerAlias
in interface X509KeyManager
- Returns:
- Always null
getCertificateChain
public X509Certificate[] getCertificateChain(String alias)
- Specified by:
getCertificateChain
in interface X509KeyManager
getClientAliases
public String[] getClientAliases(String keyType,
Principal[] issuers)
- Specified by:
getClientAliases
in interface X509KeyManager
- Returns:
- An array with the alias given in the constructor as the only element
getPrivateKey
public PrivateKey getPrivateKey(String alias)
- Specified by:
getPrivateKey
in interface X509KeyManager
getServerAliases
public String[] getServerAliases(String keyType,
Principal[] issuers)
- Specified by:
getServerAliases
in interface X509KeyManager
- Returns:
- Always null