Package org.opends.admin.ads.util
Class ApplicationKeyManager
- java.lang.Object
-
- org.opends.admin.ads.util.ApplicationKeyManager
-
- All Implemented Interfaces:
KeyManager,X509KeyManager
public class ApplicationKeyManager extends Object implements X509KeyManager
This class is in charge of checking whether the certificates that are presented are trusted or not. This implementation tries to check also that the subject DN of the certificate corresponds to the host passed using the setHostName method. The constructor tries to use a default TrustManager from the system and if it cannot be retrieved this class will only accept the certificates explicitly accepted by the user (and specified by calling acceptCertificate). NOTE: this class is not aimed to be used when we have connections in parallel.
-
-
Constructor Summary
Constructors Constructor Description ApplicationKeyManager(KeyStore keystore, char[] password)The default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringchooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)StringchooseServerAlias(String keyType, Principal[] issuers, Socket socket)X509Certificate[]getCertificateChain(String alias)String[]getClientAliases(String keyType, Principal[] issuers)PrivateKeygetPrivateKey(String alias)String[]getServerAliases(String keyType, Principal[] issuers)
-
-
-
Constructor Detail
-
ApplicationKeyManager
public ApplicationKeyManager(KeyStore keystore, char[] password)
The default constructor.- Parameters:
keystore- The keystore to use for this keymanager.password- The keystore password to use for this keymanager.
-
-
Method Detail
-
chooseClientAlias
public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
- Specified by:
chooseClientAliasin interfaceX509KeyManager
-
chooseServerAlias
public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
- Specified by:
chooseServerAliasin interfaceX509KeyManager
-
getCertificateChain
public X509Certificate[] getCertificateChain(String alias)
- Specified by:
getCertificateChainin interfaceX509KeyManager
-
getClientAliases
public String[] getClientAliases(String keyType, Principal[] issuers)
- Specified by:
getClientAliasesin interfaceX509KeyManager
-
getPrivateKey
public PrivateKey getPrivateKey(String alias)
- Specified by:
getPrivateKeyin interfaceX509KeyManager
-
getServerAliases
public String[] getServerAliases(String keyType, Principal[] issuers)
- Specified by:
getServerAliasesin interfaceX509KeyManager
-
-