Class SSLTrustManagerWithHostnameChecking

  • All Implemented Interfaces:
    javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager

    public class SSLTrustManagerWithHostnameChecking
    extends javax.net.ssl.X509ExtendedTrustManager
    Wires CANL abstractions: credentials and verificators into Java SSL socket factory. Supports hostname verification with a custom callback. If callback is unset then the mismatch of hostname to peer's certificate is considered a fatal error.
    • Method Detail

      • checkClientTrusted

        public void checkClientTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Throws:
        java.security.cert.CertificateException
      • checkServerTrusted

        public void checkServerTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Throws:
        java.security.cert.CertificateException
      • getAcceptedIssuers

        public java.security.cert.X509Certificate[] getAcceptedIssuers()
      • checkIfTrusted

        protected void checkIfTrusted​(java.security.cert.X509Certificate[] certChain)
                               throws java.security.cert.CertificateException
        Throws:
        java.security.cert.CertificateException
      • checkClientTrusted

        public void checkClientTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType,
                                       java.net.Socket socket)
                                throws java.security.cert.CertificateException
        Specified by:
        checkClientTrusted in class javax.net.ssl.X509ExtendedTrustManager
        Throws:
        java.security.cert.CertificateException
      • checkServerTrusted

        public void checkServerTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType,
                                       java.net.Socket socket)
                                throws java.security.cert.CertificateException
        Specified by:
        checkServerTrusted in class javax.net.ssl.X509ExtendedTrustManager
        Throws:
        java.security.cert.CertificateException
      • checkClientTrusted

        public void checkClientTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType,
                                       javax.net.ssl.SSLEngine engine)
                                throws java.security.cert.CertificateException
        Specified by:
        checkClientTrusted in class javax.net.ssl.X509ExtendedTrustManager
        Throws:
        java.security.cert.CertificateException
      • checkServerTrusted

        public void checkServerTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType,
                                       javax.net.ssl.SSLEngine engine)
                                throws java.security.cert.CertificateException
        Specified by:
        checkServerTrusted in class javax.net.ssl.X509ExtendedTrustManager
        Throws:
        java.security.cert.CertificateException