Package javax.net.ssl

Examples of javax.net.ssl.TrustManagerFactory


        TrustManager[] tms = null;

        KeyStore trustStore = getTrustStore(keystoreType, keystoreProvider);
        if (trustStore != null || endpoint.getTrustManagerClassName() != null) {
            if (crlf == null) {
                TrustManagerFactory tmf =
                    TrustManagerFactory.getInstance(algorithm);
                tmf.init(trustStore);
                tms = tmf.getTrustManagers();
            } else {
                TrustManagerFactory tmf =
                    TrustManagerFactory.getInstance(algorithm);
                CertPathParameters params =
                    getParameters(algorithm, crlf, trustStore);
                ManagerFactoryParameters mfp =
                    new CertPathTrustManagerParameters(params);
                tmf.init(mfp);
                tms = tmf.getTrustManagers();
            }
        }

        return tms;
    }
View Full Code Here


    private static TrustManager[] createTrustManagers(final KeyStore keystore)
        throws KeyStoreException, NoSuchAlgorithmException {
        if (keystore == null) {
            throw new IllegalArgumentException("Keystore may not be null");
        }
        TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
            TrustManagerFactory.getDefaultAlgorithm());
        tmfactory.init(keystore);
        return tmfactory.getTrustManagers();
    }
View Full Code Here

        KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory
                .getDefaultAlgorithm());
        kmfactory.init(ks, pwd);
        KeyManager[] keymanagers = kmfactory.getKeyManagers();
           
        TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
                TrustManagerFactory.getDefaultAlgorithm());
        tmfactory.init(ks);
        TrustManager[] trustmanagers = tmfactory.getTrustManagers();
       
        SSLContext sslcontext = SSLContext.getInstance("TLSv1");
        sslcontext.init(keymanagers, trustmanagers, null);
       
        LocalTestServer server = new LocalTestServer(null, null, null, sslcontext);
View Full Code Here

        }
        KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(
                KeyManagerFactory.getDefaultAlgorithm());
        kmfactory.init(keystore, keystorePassword != null ? keystorePassword.toCharArray(): null);
        KeyManager[] keymanagers =  kmfactory.getKeyManagers();
        TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
                TrustManagerFactory.getDefaultAlgorithm());
        tmfactory.init(keystore);
        TrustManager[] trustmanagers = tmfactory.getTrustManagers();
        if (trustmanagers != null && trustStrategy != null) {
            for (int i = 0; i < trustmanagers.length; i++) {
                TrustManager tm = trustmanagers[i];
                if (tm instanceof X509TrustManager) {
                    trustmanagers[i] = new TrustManagerDecorator(
View Full Code Here

    private ManagerFactoryParameters trustManagerFactoryParameters = null;
   
    protected Object createInstance() throws Exception
    {
        KeyManagerFactory kmf = this.keyManagerFactory;
        TrustManagerFactory tmf = this.trustManagerFactory;
       
        if( kmf == null )
        {
            String algorithm = keyManagerFactoryAlgorithm;
            if( algorithm == null && keyManagerFactoryAlgorithmUseDefault )
            {
                algorithm = KeyManagerFactory.getDefaultAlgorithm();
            }
            if( algorithm != null )
            {
                if( keyManagerFactoryProvider == null )
                {
                    kmf = KeyManagerFactory.getInstance( algorithm );
                }
                else
                {
                    kmf = KeyManagerFactory.getInstance( algorithm,
                                                    keyManagerFactoryProvider );
                }
            }
        }
       
        if( tmf == null )
        {
            String algorithm = trustManagerFactoryAlgorithm;
            if( algorithm == null && trustManagerFactoryAlgorithmUseDefault )
            {
                algorithm = TrustManagerFactory.getDefaultAlgorithm();
            }
            if( algorithm != null )
            {
                if( trustManagerFactoryProvider == null )
                {
                    tmf = TrustManagerFactory.getInstance( algorithm );
                }
                else
                {
                    tmf = TrustManagerFactory.getInstance( algorithm,
                                                  trustManagerFactoryProvider );
                }
            }
        }
       
        KeyManager[] keyManagers = null;
        if( kmf != null )
        {
            kmf.init( keyManagerFactoryKeyStore,
                      keyManagerFactoryKeyStorePassword );
            keyManagers = kmf.getKeyManagers();
        }
        TrustManager[] trustManagers = null;
        if( tmf != null )
        {
            if( trustManagerFactoryParameters != null )
            {
                tmf.init( trustManagerFactoryParameters );
            }
            else
            {
                tmf.init( trustManagerFactoryKeyStore );
            }
            trustManagers = tmf.getTrustManagers();
        }
       
        SSLContext context = null;
        if( provider == null )
        {
View Full Code Here

    {
        String trustMgmtAlgo = "SunX509";

        try
        {
            TrustManagerFactory tmFactory = TrustManagerFactory.getInstance( trustMgmtAlgo );
            tmFactory.init( KeyStore.getInstance( KeyStore.getDefaultType() ) );

            TrustManager factoryTrustManagers[] = tmFactory.getTrustManagers();

            for ( int i = 0; i < factoryTrustManagers.length; i++ )
            {
                if ( factoryTrustManagers[i] instanceof X509TrustManager )
                {
View Full Code Here

    private static TrustManager[] createTrustManagers(final KeyStore keystore)
        throws KeyStoreException, NoSuchAlgorithmException {
        if (keystore == null) {
            throw new IllegalArgumentException("Keystore may not be null");
        }
        TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
            TrustManagerFactory.getDefaultAlgorithm());
        tmfactory.init(keystore);
        return tmfactory.getTrustManagers();
    }
View Full Code Here

        String algo = algorithm != null ? algorithm : TLS;
        KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(
                KeyManagerFactory.getDefaultAlgorithm());
        kmfactory.init(keystore, keystorePassword != null ? keystorePassword.toCharArray(): null);
        KeyManager[] keymanagers =  kmfactory.getKeyManagers();
        TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
                TrustManagerFactory.getDefaultAlgorithm());
        tmfactory.init(truststore);
        TrustManager[] trustmanagers = tmfactory.getTrustManagers();
        if (trustmanagers != null && trustStrategy != null) {
            for (int i = 0; i < trustmanagers.length; i++) {
                TrustManager tm = trustmanagers[i];
                if (tm instanceof X509TrustManager) {
                    trustmanagers[i] = new TrustManagerDecorator(
View Full Code Here

           
            KeyStore trustStore=KeyStore.getInstance(_trustStoreType);
            trustStore.load(truststoreInputStream,_trustStorePassword==null?null:_trustStorePassword.toString().toCharArray());          
            truststoreInputStream.close();
           
            TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance(_trustManagerAlgorithm);
            trustManagerFactory.init(trustStore);
            trustManagers=trustManagerFactory.getTrustManagers();

            SecureRandom secureRandom=_secureRandomAlgorithm==null?null:SecureRandom.getInstance(_secureRandomAlgorithm);
            SSLContext context=_provider==null?SSLContext.getInstance(_protocol):SSLContext.getInstance(_protocol,_provider);
            context.init(keyManagers,trustManagers,secureRandom);
            return context;
View Full Code Here

      {
        truststoreInputStream.close();
      }
    }
       
        TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(_sslTrustManagerFactoryAlgorithm);
        trustManagerFactory.init(trustStore);
        trustManagers = trustManagerFactory.getTrustManagers();
       

        SecureRandom secureRandom = _secureRandomAlgorithm==null?null:SecureRandom.getInstance(_secureRandomAlgorithm);

        SSLContext context = _provider==null?SSLContext.getInstance(_protocol):SSLContext.getInstance(_protocol, _provider);
View Full Code Here

TOP

Related Classes of javax.net.ssl.TrustManagerFactory

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.