- All Implemented Interfaces:
KeyManager,X509KeyManager,CombinableX509KeyManager,RoutableX509KeyManager
X509ExtendedKeyManager with most-preferred managers first.
This is necessary because of the fine-print on SSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom):
Only the first instance of a particular key and/or key manager implementation type in the
array is used. (For example, only the first javax.net.ssl.X509KeyManager in the array will be used.)
The KeyManager can be build from one or more of any combination provided within the KeyManagerUtils.KeyManagerBuilder.
This includes:
- Any amount of custom KeyManagers
- Any amount of custom Identities
NOTE:
Please don't use this class directly as it is part of the internal API. Class name and methods can be changed any time.
Instead use the KeyManagerUtils which provides the same functionality
while it has a stable API because it is part of the public API.
- See Also:
-
Field Summary
FieldsFields inherited from interface nl.altindag.ssl.keymanager.RoutableX509KeyManager
NON_NULL -
Constructor Summary
ConstructorsConstructorDescriptionAggregatedX509ExtendedKeyManager(Map<String, ? extends X509ExtendedKeyManager> keyManagers) Creates a newAggregatedX509ExtendedKeyManager.AggregatedX509ExtendedKeyManager(Map<String, ? extends X509ExtendedKeyManager> keyManagers, Map<String, List<URI>> preferredAliasToHost) Creates a newAggregatedX509ExtendedKeyManager. -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) Chooses the first non-null client alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.chooseEngineClientAlias(String[] keyTypes, Principal[] issuers, SSLEngine sslEngine) Chooses the first non-null client alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine sslEngine) Chooses the first non-null server alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.chooseServerAlias(String keyType, Principal[] issuers, Socket socket) Chooses the first non-null server alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.getCertificateChain(String alias) Returns the first non-null certificate chain associated with the given alias, ornullif the alias can't be found.String[]getClientAliases(String keyType, Principal[] issuers) Get all matching aliases for authenticating the client side of a secure socket, ornullif there are no matches.getPrivateKey(String alias) Returns the first non-null private key associated with the given alias, ornullif the alias can't be found.String[]getServerAliases(String keyType, Principal[] issuers) Get all matching aliases for authenticating the server side of a secure socket, ornullif there are no matches.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nl.altindag.ssl.keymanager.CombinableX509KeyManager
extractInnerField, getAliasesMethods inherited from interface nl.altindag.ssl.keymanager.RoutableX509KeyManager
chooseAlias, chooseClientAlias, chooseServerAlias, containsInetSocketAddress, getPreferredClientAlias, getPreferredClientAlias, getPreferredServerAlias, getPreferredServerAlias
-
Field Details
-
keyManagers
-
preferredAliasToHost
-
-
Constructor Details
-
AggregatedX509ExtendedKeyManager
Creates a newAggregatedX509ExtendedKeyManager.- Parameters:
keyManagers- theX509ExtendedKeyManager, ordered with the most-preferred managers first.
-
AggregatedX509ExtendedKeyManager
public AggregatedX509ExtendedKeyManager(Map<String, ? extends X509ExtendedKeyManager> keyManagers, Map<String, List<URI>> preferredAliasToHost) Creates a newAggregatedX509ExtendedKeyManager.- Parameters:
keyManagers- theX509ExtendedKeyManager, ordered with the most-preferred managers first.preferredAliasToHost- the preferred client alias to be used for the given host
-
-
Method Details
-
chooseClientAlias
Chooses the first non-null client alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.- Specified by:
chooseClientAliasin interfaceX509KeyManager
-
chooseEngineClientAlias
Chooses the first non-null client alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.- Overrides:
chooseEngineClientAliasin classX509ExtendedKeyManager
-
chooseServerAlias
Chooses the first non-null server alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.- Specified by:
chooseServerAliasin interfaceX509KeyManager
-
chooseEngineServerAlias
Chooses the first non-null server alias returned from the delegateX509ExtendedKeyManager, ornullif there are no matches.- Overrides:
chooseEngineServerAliasin classX509ExtendedKeyManager
-
getPrivateKey
Returns the first non-null private key associated with the given alias, ornullif the alias can't be found.- Specified by:
getPrivateKeyin interfaceX509KeyManager
-
getCertificateChain
Returns the first non-null certificate chain associated with the given alias, ornullif the alias can't be found.- Specified by:
getCertificateChainin interfaceX509KeyManager
-
getClientAliases
Get all matching aliases for authenticating the client side of a secure socket, ornullif there are no matches.- Specified by:
getClientAliasesin interfaceX509KeyManager
-
getServerAliases
Get all matching aliases for authenticating the server side of a secure socket, ornullif there are no matches.- Specified by:
getServerAliasesin interfaceX509KeyManager
-
getInnerKeyManagers
- Specified by:
getInnerKeyManagersin interfaceCombinableX509KeyManager
-
getIdentityRoute
- Specified by:
getIdentityRoutein interfaceRoutableX509KeyManager
-