Package org.glassfish.grizzly.config.ssl
Class JSSEKeyManager
java.lang.Object
javax.net.ssl.X509ExtendedKeyManager
org.glassfish.grizzly.config.ssl.JSSEKeyManager
- All Implemented Interfaces:
KeyManager,X509KeyManager
X509KeyManager which allows selection of a specific keypair and certificate chain (identified by their keystore alias
name) to be used by the server to authenticate itself to SSL clients.
- Author:
- Jan Luehe
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) Choose an alias to authenticate the client side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) Choose an alias to authenticate the client side of an SSLEngine connection given the public key type and the list of certificate issuer authorities recognized by the peer (if any).chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) Choose an alias to authenticate the server side of an SSLEngine connection given the public key type and the list of certificate issuer authorities recognized by the peer (if any).chooseServerAlias(String keyType, Principal[] issuers, Socket socket) Returns this key manager's server key alias that was provided in the constructor.getCertificateChain(String alias) Returns the certificate chain associated with the given alias.String[]getClientAliases(String keyType, Principal[] issuers) Get the matching aliases for authenticating the client side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).getPrivateKey(String alias) Returns the key associated with the given alias.String[]getServerAliases(String keyType, Principal[] issuers) Get the matching aliases for authenticating the server side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).
-
Constructor Details
-
JSSEKeyManager
Constructor.- Parameters:
mgr- The X509KeyManager used as a delegateserverKeyAlias- The alias name of the server's key pair and supporting certificate chain
-
-
Method Details
-
chooseEngineClientAlias
Choose an alias to authenticate the client side of an SSLEngine connection given the public key type and the list of certificate issuer authorities recognized by the peer (if any).- Overrides:
chooseEngineClientAliasin classX509ExtendedKeyManager- Returns:
- The alias name for the desired key, or null if there are no matches
-
chooseEngineServerAlias
Choose an alias to authenticate the server side of an SSLEngine connection given the public key type and the list of certificate issuer authorities recognized by the peer (if any).- Overrides:
chooseEngineServerAliasin classX509ExtendedKeyManager- Returns:
- Alias name for the desired key
-
chooseClientAlias
Choose an alias to authenticate the client side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).- Parameters:
keyType- The key algorithm type name(s), ordered with the most-preferred key type firstissuers- The list of acceptable CA issuer subject names, or null if it does not matter which issuers are usedsocket- The socket to be used for this connection. This parameter can be null, in which case this method will return the most generic alias to use- Returns:
- The alias name for the desired key, or null if there are no matches
-
chooseServerAlias
Returns this key manager's server key alias that was provided in the constructor.- Parameters:
keyType- The key algorithm type name (ignored)issuers- The list of acceptable CA issuer subject names, or null if it does not matter which issuers are used (ignored)socket- The socket to be used for this connection. This parameter can be null, in which case this method will return the most generic alias to use (ignored)- Returns:
- Alias name for the desired key
-
getCertificateChain
Returns the certificate chain associated with the given alias.- Parameters:
alias- The alias name- Returns:
- Certificate chain (ordered with the user's certificate first and the root certificate authority last), or null if the alias can't be found
-
getClientAliases
Get the matching aliases for authenticating the client side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).- Parameters:
keyType- The key algorithm type nameissuers- The list of acceptable CA issuer subject names, or null if it does not matter which issuers are used- Returns:
- Array of the matching alias names, or null if there were no matches
-
getServerAliases
Get the matching aliases for authenticating the server side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any).- Parameters:
keyType- The key algorithm type nameissuers- The list of acceptable CA issuer subject names, or null if it does not matter which issuers are used- Returns:
- Array of the matching alias names, or null if there were no matches
-
getPrivateKey
Returns the key associated with the given alias.- Parameters:
alias- The alias name- Returns:
- The requested key, or null if the alias can't be found
-