Class JSSEKeyManager

  • All Implemented Interfaces:
    javax.net.ssl.KeyManager, javax.net.ssl.X509KeyManager

    public final class JSSEKeyManager
    extends javax.net.ssl.X509ExtendedKeyManager
    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 
      Constructor Description
      JSSEKeyManager​(javax.net.ssl.X509KeyManager mgr, java.lang.String serverKeyAlias)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String chooseClientAlias​(java.lang.String[] keyType, java.security.Principal[] issuers, java.net.Socket socket)  
      java.lang.String chooseEngineClientAlias​(java.lang.String[] keyType, java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine)  
      java.lang.String chooseEngineServerAlias​(java.lang.String keyType, java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine)
      Returns the server key alias that was provided in the constructor or the result from X509ExtendedKeyManager.chooseEngineServerAlias(String, Principal[], SSLEngine) for the delegate if no alias is specified.
      java.lang.String chooseServerAlias​(java.lang.String keyType, java.security.Principal[] issuers, java.net.Socket socket)
      Returns the server key alias that was provided in the constructor or the result from X509KeyManager.chooseServerAlias(String, Principal[], Socket) for the delegate if no alias is specified.
      java.security.cert.X509Certificate[] getCertificateChain​(java.lang.String alias)  
      java.lang.String[] getClientAliases​(java.lang.String keyType, java.security.Principal[] issuers)  
      java.security.PrivateKey getPrivateKey​(java.lang.String alias)  
      java.lang.String[] getServerAliases​(java.lang.String keyType, java.security.Principal[] issuers)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSSEKeyManager

        public JSSEKeyManager​(javax.net.ssl.X509KeyManager mgr,
                              java.lang.String serverKeyAlias)
        Constructor.
        Parameters:
        mgr - The X509KeyManager used as a delegate
        serverKeyAlias - The alias name of the server's keypair and supporting certificate chain
    • Method Detail

      • chooseServerAlias

        public java.lang.String chooseServerAlias​(java.lang.String keyType,
                                                  java.security.Principal[] issuers,
                                                  java.net.Socket socket)
        Returns the server key alias that was provided in the constructor or the result from X509KeyManager.chooseServerAlias(String, Principal[], Socket) for the delegate if no alias is specified.
      • chooseEngineServerAlias

        public java.lang.String chooseEngineServerAlias​(java.lang.String keyType,
                                                        java.security.Principal[] issuers,
                                                        javax.net.ssl.SSLEngine engine)
        Returns the server key alias that was provided in the constructor or the result from X509ExtendedKeyManager.chooseEngineServerAlias(String, Principal[], SSLEngine) for the delegate if no alias is specified.
        Overrides:
        chooseEngineServerAlias in class javax.net.ssl.X509ExtendedKeyManager
      • chooseClientAlias

        public java.lang.String chooseClientAlias​(java.lang.String[] keyType,
                                                  java.security.Principal[] issuers,
                                                  java.net.Socket socket)
      • getCertificateChain

        public java.security.cert.X509Certificate[] getCertificateChain​(java.lang.String alias)
      • getClientAliases

        public java.lang.String[] getClientAliases​(java.lang.String keyType,
                                                   java.security.Principal[] issuers)
      • getServerAliases

        public java.lang.String[] getServerAliases​(java.lang.String keyType,
                                                   java.security.Principal[] issuers)
      • getPrivateKey

        public java.security.PrivateKey getPrivateKey​(java.lang.String alias)
      • chooseEngineClientAlias

        public java.lang.String chooseEngineClientAlias​(java.lang.String[] keyType,
                                                        java.security.Principal[] issuers,
                                                        javax.net.ssl.SSLEngine engine)
        Overrides:
        chooseEngineClientAlias in class javax.net.ssl.X509ExtendedKeyManager