Package net.sf.basedb.util.ssl
Class StaticKeyManager
java.lang.Object
net.sf.basedb.util.ssl.StaticKeyManager
- All Implemented Interfaces:
KeyManager
,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 (on, 16 jun 2010) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStaticKeyManager
(KeyStore keyStore, String alias, String password) Create a new key manager -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias
(String[] keyType, Principal[] issuers, Socket socket) chooseServerAlias
(String keyType, Principal[] issuers, Socket socket) getCertificateChain
(String alias) String[]
getClientAliases
(String keyType, Principal[] issuers) getPrivateKey
(String alias) String[]
getServerAliases
(String keyType, Principal[] issuers)
-
Field Details
-
keyStore
-
alias
-
password
private final char[] password
-
-
Constructor Details
-
StaticKeyManager
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
-
-
Method Details
-
chooseClientAlias
- Specified by:
chooseClientAlias
in interfaceX509KeyManager
- Returns:
- Always the alias specified in the constructor
-
chooseServerAlias
- Specified by:
chooseServerAlias
in interfaceX509KeyManager
- Returns:
- Always null
-
getCertificateChain
- Specified by:
getCertificateChain
in interfaceX509KeyManager
-
getClientAliases
- Specified by:
getClientAliases
in interfaceX509KeyManager
- Returns:
- An array with the alias given in the constructor as the only element
-
getPrivateKey
- Specified by:
getPrivateKey
in interfaceX509KeyManager
-
getServerAliases
- Specified by:
getServerAliases
in interfaceX509KeyManager
- Returns:
- Always null
-