Package javax.net.ssl

Examples of javax.net.ssl.TrustManager


                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(
                            (X509TrustManager) tm, trustStrategy);
                }
            }
View Full Code Here


             if(!(TrustManager.class.isAssignableFrom(clazz))){
                throw new InstantiationException(sm.getString(
                        "jsse.invalidTrustManagerClassName", className));
             }
             Object trustManagerObject = clazz.newInstance();
             TrustManager trustManager = (TrustManager) trustManagerObject;
             return new TrustManager[]{ trustManager };
        }   

        TrustManager[] tms = null;
       
View Full Code Here

             if(!(TrustManager.class.isAssignableFrom(clazz))){
                throw new InstantiationException(sm.getString(
                        "jsse.invalidTrustManagerClassName", className));
             }
             Object trustManagerObject = clazz.newInstance();
             TrustManager trustManager = (TrustManager) trustManagerObject;
             return new TrustManager[]{ trustManager };
        }

        TrustManager[] tms = null;
View Full Code Here

            if (trustManagers == null || trustManagers.length == 0) {
                return null;
            }
            List x509TrustManagers = new ArrayList();
            for (int i = 0; i < trustManagers.length; i++) {
                TrustManager trustManager = trustManagers[i];
                if (trustManager instanceof X509TrustManager) {
                    x509TrustManagers.add(trustManager);
                }
            }
            return (X509TrustManager[]) x509TrustManagers.toArray(new X509TrustManager[x509TrustManagers.size()]);
View Full Code Here

        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

        // ConnectionFactory reference
        ConnectionFactory connectionFactory = resolveAndRemoveReferenceParameter(params, "connectionFactory", ConnectionFactory.class);
        @SuppressWarnings("unchecked")
        Map<String, Object> clientProperties = resolveAndRemoveReferenceParameter(params, "clientProperties", Map.class);
        TrustManager trustManager = resolveAndRemoveReferenceParameter(params, "trustManager", TrustManager.class);
        RabbitMQEndpoint endpoint;
        if (connectionFactory == null) {
            endpoint = new RabbitMQEndpoint(uri, this);
        } else {
            endpoint = new RabbitMQEndpoint(uri, this, connectionFactory);
View Full Code Here

   * @throws Exception
   */   
    private static void trustAllHttpsCertificates() throws Exception {
        //  Create a trust manager that does not validate certificate chains:
      TrustManager[] trustAllCerts = new TrustManager[1];
        TrustManager tm = new miTM();
        trustAllCerts[0] = tm;
        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, null);
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    }
View Full Code Here

  public OpenSSLSocketFactory(KeyStore truststore)
      throws NoSuchAlgorithmException, KeyManagementException,
      KeyStoreException, UnrecoverableKeyException {
    super(truststore);
   
    TrustManager tm = new X509TrustManager() {
     
      @Override
      public void checkClientTrusted(X509Certificate[] chain,
          String authType) throws CertificateException {
      }
View Full Code Here

  private SSLContext getSSLContext () throws NoSuchAlgorithmException, KeyManagementException
  {
    if (ctx != null) return ctx;
    log.trace("Creating SSL context with no certificate validation");
    ctx = SSLContext.getInstance("SSL");
    TrustManager tm = new X509TrustManager()
    {

      @Override
      public void checkClientTrusted ( X509Certificate[] arg0, String arg1 ) throws CertificateException
      {
View Full Code Here

     * Test to see that the message "JERSEY HTTPS EXAMPLE" is sent in the response.
     */
    @Test
    public void testSSLWithAuth() {

        TrustManager mytm[] = null;
        KeyManager mykm[] = null;

        try {
            mytm = new TrustManager[]{new MyX509TrustManager("./truststore_client", "asdfgh".toCharArray())};
            mykm = new KeyManager[]{new MyX509KeyManager("./keystore_client", "asdfgh".toCharArray())};
View Full Code Here

TOP

Related Classes of javax.net.ssl.TrustManager

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.