public final class CompositeX509ExtendedKeyManager extends X509ExtendedKeyManager
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
.
- 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.
Constructor and Description |
---|
CompositeX509ExtendedKeyManager(List<? extends X509ExtendedKeyManager> keyManagers)
Creates a new
CompositeX509ExtendedKeyManager . |
CompositeX509ExtendedKeyManager(List<? extends X509ExtendedKeyManager> keyManagers,
Map<String,List<URI>> preferredClientAliasToHost)
Creates a new
CompositeX509ExtendedKeyManager . |
Modifier and Type | Method and Description |
---|---|
String |
chooseClientAlias(String[] keyType,
Principal[] issuers,
Socket socket)
Chooses the first non-null client alias returned from the delegate
X509ExtendedKeyManager , or null if there are no matches. |
String |
chooseEngineClientAlias(String[] keyTypes,
Principal[] issuers,
SSLEngine sslEngine)
Chooses the first non-null client alias returned from the delegate
X509ExtendedKeyManager , or null if there are no matches. |
String |
chooseEngineServerAlias(String keyType,
Principal[] issuers,
SSLEngine sslEngine)
Chooses the first non-null server alias returned from the delegate
X509ExtendedKeyManager , or null if there are no matches. |
String |
chooseServerAlias(String keyType,
Principal[] issuers,
Socket socket)
Chooses the first non-null server alias returned from the delegate
X509ExtendedKeyManager , or null if there are no matches. |
X509Certificate[] |
getCertificateChain(String alias)
Returns the first non-null certificate chain associated with the
given alias, or
null if 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, or
null if there are no matches. |
List<X509ExtendedKeyManager> |
getKeyManagers() |
Map<String,List<URI>> |
getPreferredClientAliasToHosts() |
PrivateKey |
getPrivateKey(String alias)
Returns the first non-null private key associated with the
given alias, or
null if 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, or
null if there are no matches. |
int |
size() |
public CompositeX509ExtendedKeyManager(List<? extends X509ExtendedKeyManager> keyManagers)
CompositeX509ExtendedKeyManager
.keyManagers
- the X509ExtendedKeyManager
, ordered with the most-preferred managers first.public CompositeX509ExtendedKeyManager(List<? extends X509ExtendedKeyManager> keyManagers, Map<String,List<URI>> preferredClientAliasToHost)
CompositeX509ExtendedKeyManager
.keyManagers
- the X509ExtendedKeyManager
, ordered with the most-preferred managers first.preferredClientAliasToHost
- the preferred client alias to be used for the given hostpublic String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
X509ExtendedKeyManager
, or null
if there are no matches.public String chooseEngineClientAlias(String[] keyTypes, Principal[] issuers, SSLEngine sslEngine)
X509ExtendedKeyManager
, or null
if there are no matches.chooseEngineClientAlias
in class X509ExtendedKeyManager
public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
X509ExtendedKeyManager
, or null
if there are no matches.public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine sslEngine)
X509ExtendedKeyManager
, or null
if there are no matches.chooseEngineServerAlias
in class X509ExtendedKeyManager
public PrivateKey getPrivateKey(String alias)
null
if the alias can't be found.public X509Certificate[] getCertificateChain(String alias)
null
if the alias can't be found.public String[] getClientAliases(String keyType, Principal[] issuers)
null
if there are no matches.public String[] getServerAliases(String keyType, Principal[] issuers)
null
if there are no matches.public int size()
public List<X509ExtendedKeyManager> getKeyManagers()
Copyright © 2021. All rights reserved.