Package javax.net.ssl

Examples of javax.net.ssl.TrustManagerFactory


         String tsPasswd = getTrustStorePassword();
         URL tsPathURL = getTrustStore();

         String tsAlg = getTrustStoreAlgorithm();

         TrustManagerFactory trustMgrFactory;
         KeyStore trustStore = loadKeyStore(tsType, tsPathURL, tsPasswd);

         if (getProvider() != null)
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg, getProvider());
         }
         else if (getProviderName() != null)
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg, getProviderName());
         }
         else
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg);
         }

         if (trustStore != null)
         {
            trustMgrFactory.init(trustStore);

            trustManagers = trustMgrFactory.getTrustManagers();
         }
      }

      return trustManagers;
   }
View Full Code Here


      kmf.init(server_keystore, keyPassphrase);     
      // KeyManagers from the KeyManagerFactory
      KeyManager[] keyManagers = kmf.getKeyManagers();

      // initialize a TrustManagerFactory with the TrustStore
      TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
      tmf.init(server_truststore);
      // TrustManagers from the TrustManagerFactory
      TrustManager[] trustManagers = tmf.getTrustManagers();

      // initialize context with Keystore and Truststore information
      context.init(keyManagers, trustManagers, null);

      // get ServerSocketFactory from context
View Full Code Here

                        theTrustStore.load(null);
                    }
                    for (X509Certificate current : temporarilyTrusted) {
                        theTrustStore.setCertificateEntry(current.getSubjectX500Principal().getName(), current);
                    }
                    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
                    trustManagerFactory.init(theTrustStore);
                    TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
                    for (TrustManager current : trustManagers) {
                        if (current instanceof X509TrustManager) {
                            delegate = (X509TrustManager) current;
                            break;
                        }
View Full Code Here

    */
   protected TrustManager[] getTrustManagers(String keystoreType, String algorithm)
      throws Exception
   {
      verifySecurityDomain();
      TrustManagerFactory tmf = securityDomain.getTrustManagerFactory();
      TrustManager[] trustMgrs = null;

      if( tmf != null )
      {
          trustMgrs = tmf.getTrustManagers();
      }
      return trustMgrs;
   }
View Full Code Here

         String tsPasswd = getTrustStorePassword();
         URL tsPathURL = getTrustStore();

         String tsAlg = getTrustStoreAlgorithm();

         TrustManagerFactory trustMgrFactory;
         KeyStore trustStore = loadKeyStore(tsType, tsPathURL, tsPasswd);

         if (getProvider() != null)
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg, getProvider());
         }
         else if (getProviderName() != null)
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg, getProviderName());
         }
         else
         {
            trustMgrFactory = TrustManagerFactory.getInstance(tsAlg);
         }

         if (trustStore != null)
         {
            trustMgrFactory.init(trustStore);

            trustManagers = trustMgrFactory.getTrustManagers();
         }
      }

      return trustManagers;
   }
View Full Code Here

      kmf.init(server_keystore, keyPassphrase);     
      // KeyManagers from the KeyManagerFactory
      KeyManager[] keyManagers = kmf.getKeyManagers();

      // initialize a TrustManagerFactory with the TrustStore
      TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
      tmf.init(server_truststore);
      // TrustManagers from the TrustManagerFactory
      TrustManager[] trustManagers = tmf.getTrustManagers();

      // initialize context with Keystore and Truststore information
      context.init(keyManagers, trustManagers, null);

      // get ServerSocketFactory from context
View Full Code Here

            truststoreType = keystoreType;
        }
        KeyStore trustStore = getTrustStore(truststoreType);
        if (trustStore != 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

                        theTrustStore.load(null);
                    }
                    for (X509Certificate current : temporarilyTrusted) {
                        theTrustStore.setCertificateEntry(current.getSubjectX500Principal().getName(), current);
                    }
                    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
                    trustManagerFactory.init(theTrustStore);
                    TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
                    for (TrustManager current : trustManagers) {
                        if (current instanceof X509TrustManager) {
                            delegate = (X509TrustManager) current;
                            break;
                        }
View Full Code Here

        if(truststoreType == null) {
            truststoreType = keystoreType;
        }
        KeyStore trustStore = getTrustStore(truststoreType);
        if (trustStore != null) {
            TrustManagerFactory tmf = TrustManagerFactory.getInstance(algorithm);
            tmf.init(trustStore);
            tms = tmf.getTrustManagers();
        }

        return tms;
    }
View Full Code Here

                "changeit".toCharArray());
        return kmf.getKeyManagers();
    }
   
    protected static TrustManager[] getTrustManagers() throws Exception {
        TrustManagerFactory tmf = TrustManagerFactory.getInstance(
                TrustManagerFactory.getDefaultAlgorithm());
        tmf.init(getKeyStore("test/org/apache/tomcat/util/net/ca.jks"));
        return tmf.getTrustManagers();
    }
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.