Package org.apache.http.conn.ssl

Examples of org.apache.http.conn.ssl.AllowAllHostnameVerifier


      params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000);
      params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
      if (skipValidation)
      {
        log.warn("Configuring HTTPS with no validation!");
        SSLSocketFactory sf = new SSLSocketFactory(getSSLContext(), new AllowAllHostnameVerifier());
        Scheme https = new Scheme("https", 443, sf);
        httpClient.getConnectionManager().getSchemeRegistry().register(https);
      }

    }
View Full Code Here


   */
  private ApacheHttpClient() {
   
    // Allow self-signed SSL certificates:
    final TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    final X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    final SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();

    SSLSocketFactory sslSf;
    try {
      sslSf = new SSLSocketFactory(trustStrategy,
View Full Code Here

  static DefaultHttpClient httpClient = null;

  private ApacheHttpClient() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException{
    // Allow self-signed SSL certificates:
    TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    SSLSocketFactory sslSf = new SSLSocketFactory(trustStrategy,
          hostnameVerifier);
    Scheme https = new Scheme("https", 443, sslSf);

    SchemeRegistry schemeRegistry = SchemeRegistryFactory
View Full Code Here

      params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000);
      params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
      if (skipValidation)
      {
        log.warn("Configuring HTTPS with no validation!");
        SSLSocketFactory sf = new SSLSocketFactory(getSSLContext(), new AllowAllHostnameVerifier());
        Scheme https = new Scheme("https", 443, sf);
        httpClient.getConnectionManager().getSchemeRegistry().register(https);
      }

    }
View Full Code Here

  private ApacheHttpClient() throws KeyManagementException,
      UnrecoverableKeyException, NoSuchAlgorithmException,
      KeyStoreException {
    // Allow self-signed SSL certificates:
    TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    SSLSocketFactory sslSf = new SSLSocketFactory(trustStrategy,
        hostnameVerifier);
    Scheme https = new Scheme("https", 443, sslSf);
   
    SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();
View Full Code Here

        X509HostnameVerifier verifier = null;
        if (this.verifier != null) verifier = new VerifierWrapper(this.verifier);
        else {
            switch (policy) {
                case ANY:
                    verifier = new AllowAllHostnameVerifier();
                    break;
                case WILDCARD:
                    verifier = new BrowserCompatHostnameVerifier();
                    break;
                case STRICT:
                    verifier = new StrictHostnameVerifier();
                    break;
            }
        }
        try {
            SSLSocketFactory sslsf = null;
            SSLContext theContext = sslContext;
            if (disableTrustManager) {
                theContext = SSLContext.getInstance("SSL");
                theContext.init(null, new TrustManager[]{new PassthroughTrustManager()},
                        new SecureRandom());
                verifier = new AllowAllHostnameVerifier();
                sslsf = new SSLSocketFactory(theContext, verifier);
            } else if (theContext != null) {
                sslsf = new SSLSocketFactory(theContext, verifier);
            } else if (clientKeyStore != null || truststore != null) {
                sslsf = new SSLSocketFactory(SSLSocketFactory.TLS, clientKeyStore, clientPrivateKeyPassword, truststore, null, verifier);
View Full Code Here

        X509HostnameVerifier verifier = null;
        if (this.verifier != null) verifier = new VerifierWrapper(this.verifier);
        else {
            switch (policy) {
                case ANY:
                    verifier = new AllowAllHostnameVerifier();
                    break;
                case WILDCARD:
                    verifier = new BrowserCompatHostnameVerifier();
                    break;
                case STRICT:
                    verifier = new StrictHostnameVerifier();
                    break;
            }
        }
        try {
            SSLSocketFactory sslsf = null;
            SSLContext theContext = sslContext;
            if (disableTrustManager) {
                theContext = SSLContext.getInstance("SSL");
                theContext.init(null, new TrustManager[]{new PassthroughTrustManager()},
                        new SecureRandom());
                verifier = new AllowAllHostnameVerifier();
                sslsf = new SSLSocketFactory(theContext, verifier);
            } else if (theContext != null) {
                sslsf = new SSLSocketFactory(theContext, verifier);
            } else if (clientKeyStore != null || truststore != null) {
                sslsf = new SSLSocketFactory(SSLSocketFactory.TLS, clientKeyStore, clientPrivateKeyPassword, truststore, null, verifier);
View Full Code Here

                return true;
            }
        };

        try {
            SSLSocketFactory sf = new SSLSocketFactory(easyStrategy, new AllowAllHostnameVerifier());
            SchemeRegistry registry = new SchemeRegistry();
            registry.register(new Scheme("https", DEFAULT_AGENT_PORT, sf));
            ClientConnectionManager ccm = new BasicClientConnectionManager(registry);
            httpClient = new DefaultHttpClient(ccm);
        } catch (KeyManagementException e) {
View Full Code Here

          new AuthScope(SERVER_HOSTNAME, portConfig.getPort()),
          new UsernamePasswordCredentials(portConfig.getUser().getUsername(), portConfig.getUser().getPassword()));

      // Allow all hostnames in CN; this is okay as long as hostname is localhost/127.0.0.1!
      // See: https://github.com/syncany/syncany/pull/196#issuecomment-52197017
      X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();

      // Fetch the SSL context (using the user key/trust store)
      SSLContext sslContext = UserConfig.createUserSSLContext();

      // Create client with authentication details
View Full Code Here

TOP

Related Classes of org.apache.http.conn.ssl.AllowAllHostnameVerifier

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.