Home / Class/ SimpleTrustManagerFactorySpi Class — netty Architecture

SimpleTrustManagerFactorySpi Class — netty Architecture

Architecture documentation for the SimpleTrustManagerFactorySpi class in SimpleTrustManagerFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7a9d0403_7bae_285e_2f77_a69e524bf872["SimpleTrustManagerFactorySpi"]
  ac087f6e_c81e_e574_e150_3641f405807d["SimpleTrustManagerFactory.java"]
  7a9d0403_7bae_285e_2f77_a69e524bf872 -->|defined in| ac087f6e_c81e_e574_e150_3641f405807d
  a78f29e3_4379_7ee1_a5a3_4bb35df7fd2f["init()"]
  7a9d0403_7bae_285e_2f77_a69e524bf872 -->|method| a78f29e3_4379_7ee1_a5a3_4bb35df7fd2f
  4adef5b7_2822_fba0_059a_755503d8fca0["engineInit()"]
  7a9d0403_7bae_285e_2f77_a69e524bf872 -->|method| 4adef5b7_2822_fba0_059a_755503d8fca0
  4ce90e09_f284_64a9_7ef9_40a88bd22fba["engineGetTrustManagers()"]
  7a9d0403_7bae_285e_2f77_a69e524bf872 -->|method| 4ce90e09_f284_64a9_7ef9_40a88bd22fba
  a46200fe_bab4_db27_04a1_0fb76593908f["wrapIfNeeded()"]
  7a9d0403_7bae_285e_2f77_a69e524bf872 -->|method| a46200fe_bab4_db27_04a1_0fb76593908f

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/util/SimpleTrustManagerFactory.java lines 99–150

    static final class SimpleTrustManagerFactorySpi extends TrustManagerFactorySpi {

        private SimpleTrustManagerFactory parent;
        private volatile TrustManager[] trustManagers;

        void init(SimpleTrustManagerFactory parent) {
            this.parent = parent;
        }

        @Override
        protected void engineInit(KeyStore keyStore) throws KeyStoreException {
            try {
                parent.engineInit(keyStore);
            } catch (KeyStoreException e) {
                throw e;
            } catch (Exception e) {
                throw new KeyStoreException(e);
            }
        }

        @Override
        protected void engineInit(
                ManagerFactoryParameters managerFactoryParameters) throws InvalidAlgorithmParameterException {
            try {
                parent.engineInit(managerFactoryParameters);
            } catch (InvalidAlgorithmParameterException e) {
                throw e;
            } catch (Exception e) {
                throw new InvalidAlgorithmParameterException(e);
            }
        }

        @Override
        protected TrustManager[] engineGetTrustManagers() {
            TrustManager[] trustManagers = this.trustManagers;
            if (trustManagers == null) {
                trustManagers = parent.engineGetTrustManagers();
                wrapIfNeeded(trustManagers);
                this.trustManagers = trustManagers;
            }
            return trustManagers.clone();
        }

        private static void wrapIfNeeded(TrustManager[] trustManagers) {
            for (int i = 0; i < trustManagers.length; i++) {
                final TrustManager tm = trustManagers[i];
                if (tm instanceof X509TrustManager && !(tm instanceof X509ExtendedTrustManager)) {
                    trustManagers[i] = new X509TrustManagerWrapper((X509TrustManager) tm);
                }
            }
        }
    }

Frequently Asked Questions

What is the SimpleTrustManagerFactorySpi class?
SimpleTrustManagerFactorySpi is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/util/SimpleTrustManagerFactory.java.
Where is SimpleTrustManagerFactorySpi defined?
SimpleTrustManagerFactorySpi is defined in handler/src/main/java/io/netty/handler/ssl/util/SimpleTrustManagerFactory.java at line 99.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free