Package org.glassfish.admin.mbeanserver.ssl

Examples of org.glassfish.admin.mbeanserver.ssl.SSLParams


     * @param sslConfig
     * @return SslRMIClientSocketFactory
     */
    private SslRMIClientSocketFactory getClientSocketFactory(Ssl sslConfig) {
        // create SSLParams
        SSLParams sslParams = convertToSSLParams(sslConfig);

        // configure the context using these params
        SSLClientConfigurator sslCC = SSLClientConfigurator.getInstance();
        sslCC.setSSLParams(sslParams);
        SSLContext sslContext = sslCC.configure(sslParams);

        // Now pass this context to the ClientSocketFactory
        Security.setProperty("ssl.SocketFactory.provider", sslContext.getClass().getName());

        String enabledProtocols = sslCC.getEnabledProtocolsAsString();
        if (enabledProtocols != null) {
            System.setProperty("javax.rmi.ssl.client.enabledProtocols", enabledProtocols);
        }

        String enabledCipherSuites = sslCC.getEnabledCipherSuitesAsString();
        if (enabledCipherSuites != null) {
            System.setProperty("javax.rmi.ssl.client.enabledCipherSuites", enabledCipherSuites);
        }

        // The keystore and truststore locations are already available as System properties
        // Hence we just add the passwords
        System.setProperty("javax.net.ssl.keyStorePassword",
                sslParams.getKeyStorePassword() == null ? "changeit" : sslParams.getKeyStorePassword());
        System.setProperty("javax.net.ssl.trustStorePassword",
                sslParams.getTrustStorePassword() == null ? "changeit" : sslParams.getTrustStorePassword());

        SslRMIClientSocketFactory sslRMICsf = new SslRMIClientSocketFactory();
        return sslRMICsf;
    }
View Full Code Here


                sslConfig.getTrustStorePassword() == null ? masterPassword : sslConfig.getKeyStorePassword();
        File keyStore =
                sslConfig.getTrustStore() == null ? new File(System.getProperty("javax.net.ssl.keyStore")) : new File(sslConfig.getKeyStore());


        SSLParams sslParams = new SSLParams(trustStore, trustStorePwd, trustStoreType);

        sslParams.setTrustAlgorithm(sslConfig.getTrustAlgorithm());
        sslParams.setCertNickname(sslConfig.getCertNickname());
        sslParams.setCrlFile(sslConfig.getCrlFile());

        sslParams.setClientAuthEnabled(sslConfig.getClientAuthEnabled());
        sslParams.setClientAuth(sslConfig.getClientAuth());

        sslParams.setKeyAlgorithm(sslConfig.getKeyAlgorithm());
        sslParams.setKeyStore(keyStore.getAbsolutePath());
        sslParams.setKeyStorePassword(keyStorePwd);
        sslParams.setKeyStoreType(keyStoreType);

        sslParams.setSsl2Ciphers(sslConfig.getSsl2Ciphers());
        sslParams.setSsl2Enabled(sslConfig.getSsl2Enabled());
        sslParams.setSsl3Enabled(sslConfig.getSsl3Enabled());
        sslParams.setSsl3TlsCiphers(sslConfig.getSsl3TlsCiphers());
        sslParams.setTlsEnabled(sslConfig.getTlsEnabled());
        sslParams.setTlsRollbackEnabled(sslConfig.getTlsRollbackEnabled());

        return sslParams;
    }
View Full Code Here

     * @param sslConfig
     * @return SslRMIClientSocketFactory
     */
    private SslRMIClientSocketFactory getClientSocketFactory(Ssl sslConfig) {
        // create SSLParams
        SSLParams sslParams = convertToSSLParams(sslConfig);

        // configure the context using these params
        SSLClientConfigurator sslCC = SSLClientConfigurator.getInstance();
        sslCC.setSSLParams(sslParams);
        SSLContext sslContext = sslCC.configure(sslParams);

        // Now pass this context to the ClientSocketFactory
        Security.setProperty("ssl.SocketFactory.provider", sslContext.getClass().getName());

        String enabledProtocols = sslCC.getEnabledProtocolsAsString();
        if (enabledProtocols != null) {
            System.setProperty("javax.rmi.ssl.client.enabledProtocols", enabledProtocols);
        }

        String enabledCipherSuites = sslCC.getEnabledCipherSuitesAsString();
        if (enabledCipherSuites != null) {
            System.setProperty("javax.rmi.ssl.client.enabledCipherSuites", enabledCipherSuites);
        }

        // The keystore and truststore locations are already available as System properties
        // Hence we just add the passwords
        System.setProperty("javax.net.ssl.keyStorePassword",
                sslParams.getKeyStorePassword() == null ? "changeit" : sslParams.getKeyStorePassword());
        System.setProperty("javax.net.ssl.trustStorePassword",
                sslParams.getTrustStorePassword() == null ? "changeit" : sslParams.getTrustStorePassword());

        SslRMIClientSocketFactory sslRMICsf = new SslRMIClientSocketFactory();
        return sslRMICsf;
    }
View Full Code Here

                sslConfig.getTrustStorePassword() == null ? masterPassword : sslConfig.getKeyStorePassword();
        File keyStore =
                sslConfig.getTrustStore() == null ? new File(System.getProperty("javax.net.ssl.keyStore")) : new File(sslConfig.getKeyStore());


        SSLParams sslParams = new SSLParams(trustStore, trustStorePwd, trustStoreType);

        sslParams.setTrustAlgorithm(sslConfig.getTrustAlgorithm());
        sslParams.setCertNickname(sslConfig.getCertNickname());
        sslParams.setCrlFile(sslConfig.getCrlFile());

        sslParams.setClientAuthEnabled(sslConfig.getClientAuthEnabled());
        sslParams.setClientAuth(sslConfig.getClientAuth());

        sslParams.setKeyAlgorithm(sslConfig.getKeyAlgorithm());
        sslParams.setKeyStore(keyStore.getAbsolutePath());
        sslParams.setKeyStorePassword(keyStorePwd);
        sslParams.setKeyStoreType(keyStoreType);

        sslParams.setSsl2Ciphers(sslConfig.getSsl2Ciphers());
        sslParams.setSsl2Enabled(sslConfig.getSsl2Enabled());
        sslParams.setSsl3Enabled(sslConfig.getSsl3Enabled());
        sslParams.setSsl3TlsCiphers(sslConfig.getSsl3TlsCiphers());
        sslParams.setTlsEnabled(sslConfig.getTlsEnabled());
        sslParams.setTlsRollbackEnabled(sslConfig.getTlsRollbackEnabled());

        return sslParams;
    }
View Full Code Here

     * @param sslConfig
     * @return SslRMIClientSocketFactory
     */
    private SslRMIClientSocketFactory getClientSocketFactory(Ssl sslConfig) {
        // create SSLParams
        SSLParams sslParams = convertToSSLParams(sslConfig);
        if (sslParams == null) {
            sslParams = new SSLParams(new File(System.getProperty("javax.net.ssl.trustStore")),
                    System.getProperty("javax.net.ssl.trustStoreType", "JKS"),
                    masterPassword);

        }

        // configure the context using these params
        SSLClientConfigurator sslCC = SSLClientConfigurator.getInstance();
        sslCC.setSSLParams(sslParams);
        SSLContext sslContext = sslCC.configure(sslParams);

        // Now pass this context to the ClientSocketFactory
        Object socketFactoryProvider = Security.getProperty("ssl.SocketFactory.provider");

        Security.setProperty("ssl.SocketFactory.provider", sslContext.getClass().getName());

        String enabledProtocols = sslCC.getEnabledProtocolsAsString();
        if (enabledProtocols != null) {
            System.setProperty("javax.rmi.ssl.client.enabledProtocols", enabledProtocols);
        }

        String enabledCipherSuites = sslCC.getEnabledCipherSuitesAsString();
        if (enabledCipherSuites != null) {
            System.setProperty("javax.rmi.ssl.client.enabledCipherSuites", enabledCipherSuites);
        }

        // The keystore and truststore locations are already available as System properties
        // Hence we just add the passwords
        System.setProperty("javax.net.ssl.keyStorePassword",
                sslParams.getKeyStorePassword() == null ? "changeit" : sslParams.getKeyStorePassword());
        System.setProperty("javax.net.ssl.trustStorePassword",
                sslParams.getTrustStorePassword() == null ? "changeit" : sslParams.getTrustStorePassword());

        SslRMIClientSocketFactory sslRMICsf = new SslRMIClientSocketFactory();
        return sslRMICsf;
    }
View Full Code Here

                sslConfig.getTrustStorePassword() == null ? masterPassword : sslConfig.getKeyStorePassword();
        File keyStore =
                sslConfig.getTrustStore() == null ? new File(System.getProperty("javax.net.ssl.keyStore")) : new File(sslConfig.getKeyStore());


        SSLParams sslParams = new SSLParams(trustStore, trustStorePwd, trustStoreType);

        sslParams.setTrustAlgorithm(sslConfig.getTrustAlgorithm());
        sslParams.setCertNickname(sslConfig.getCertNickname());
        sslParams.setCrlFile(sslConfig.getCrlFile());

        sslParams.setClientAuthEnabled(sslConfig.getClientAuthEnabled());
        sslParams.setClientAuth(sslConfig.getClientAuth());

        sslParams.setKeyAlgorithm(sslConfig.getKeyAlgorithm());
        sslParams.setKeyStore(keyStore.getAbsolutePath());
        sslParams.setKeyStorePassword(keyStorePwd);
        sslParams.setKeyStoreType(keyStoreType);

        sslParams.setSsl2Ciphers(sslConfig.getSsl2Ciphers());
        sslParams.setSsl2Enabled(sslConfig.getSsl2Enabled());
        sslParams.setSsl3Enabled(sslConfig.getSsl3Enabled());
        sslParams.setSsl3TlsCiphers(sslConfig.getSsl3TlsCiphers());
        sslParams.setTlsEnabled(sslConfig.getTlsEnabled());
        sslParams.setTlsRollbackEnabled(sslConfig.getTlsRollbackEnabled());

        return sslParams;
    }
View Full Code Here

TOP

Related Classes of org.glassfish.admin.mbeanserver.ssl.SSLParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.