Home / Class/ SimpleKeyManagerFactory Class — netty Architecture

SimpleKeyManagerFactory Class — netty Architecture

Architecture documentation for the SimpleKeyManagerFactory class in SimpleKeyManagerFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b8b8d9eb_b8c4_5e22_b5d2_fd42e4c73d5c["SimpleKeyManagerFactory"]
  1188aec6_2cdc_b81c_6b3c_72e2066903b3["SimpleKeyManagerFactory.java"]
  b8b8d9eb_b8c4_5e22_b5d2_fd42e4c73d5c -->|defined in| 1188aec6_2cdc_b81c_6b3c_72e2066903b3
  e6225f26_9cf0_93dc_89bf_c3a4f3338598["SimpleKeyManagerFactory()"]
  b8b8d9eb_b8c4_5e22_b5d2_fd42e4c73d5c -->|method| e6225f26_9cf0_93dc_89bf_c3a4f3338598
  786082d5_5e4f_f09d_c203_d198d3f1ee45["engineInit()"]
  b8b8d9eb_b8c4_5e22_b5d2_fd42e4c73d5c -->|method| 786082d5_5e4f_f09d_c203_d198d3f1ee45
  ca388152_a2c6_98fc_e9f3_6cd433901bd3["engineGetKeyManagers()"]
  b8b8d9eb_b8c4_5e22_b5d2_fd42e4c73d5c -->|method| ca388152_a2c6_98fc_e9f3_6cd433901bd3

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/util/SimpleKeyManagerFactory.java lines 37–150

public abstract class SimpleKeyManagerFactory extends KeyManagerFactory {

    private static final Provider PROVIDER = new Provider("", 0.0, "") {
        private static final long serialVersionUID = -2680540247105807895L;
    };

    /**
     * {@link SimpleKeyManagerFactorySpi} must have a reference to {@link SimpleKeyManagerFactory}
     * to delegate its callbacks back to {@link SimpleKeyManagerFactory}.  However, it is impossible to do so,
     * because {@link KeyManagerFactory} requires {@link KeyManagerFactorySpi} at construction time and
     * does not provide a way to access it later.
     *
     * To work around this issue, we use an ugly hack which uses a {@link FastThreadLocal }.
     */
    private static final FastThreadLocal<SimpleKeyManagerFactorySpi> CURRENT_SPI =
            new FastThreadLocal<SimpleKeyManagerFactorySpi>() {
                @Override
                protected SimpleKeyManagerFactorySpi initialValue() {
                    return new SimpleKeyManagerFactorySpi();
                }
            };

    /**
     * Creates a new instance.
     */
    protected SimpleKeyManagerFactory() {
        this(StringUtil.EMPTY_STRING);
    }

    /**
     * Creates a new instance.
     *
     * @param name the name of this {@link KeyManagerFactory}
     */
    protected SimpleKeyManagerFactory(String name) {
        super(CURRENT_SPI.get(), PROVIDER, ObjectUtil.checkNotNull(name, "name"));
        CURRENT_SPI.get().init(this);
        CURRENT_SPI.remove();
    }

    /**
     * Initializes this factory with a source of certificate authorities and related key material.
     *
     * @see KeyManagerFactorySpi#engineInit(KeyStore, char[])
     */
    protected abstract void engineInit(KeyStore keyStore, char[] var2) throws Exception;

    /**
     * Initializes this factory with a source of provider-specific key material.
     *
     * @see KeyManagerFactorySpi#engineInit(ManagerFactoryParameters)
     */
    protected abstract void engineInit(ManagerFactoryParameters managerFactoryParameters) throws Exception;

    /**
     * Returns one key manager for each type of key material.
     *
     * @see KeyManagerFactorySpi#engineGetKeyManagers()
     */
    protected abstract KeyManager[] engineGetKeyManagers();

    private static final class SimpleKeyManagerFactorySpi extends KeyManagerFactorySpi {

        private SimpleKeyManagerFactory parent;
        private volatile KeyManager[] keyManagers;

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

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

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free