Package org.apache.http.conn.ssl

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


            // Set the hostname verifier:
            final SSLReq sslReq = request.getSslReq();
            if(sslReq != null) {
                SSLHostnameVerifier verifier = sslReq.getHostNameVerifier();
                final X509HostnameVerifier hcVerifier;
                switch(verifier){
                    case STRICT:
                        hcVerifier = SSLConnectionSocketFactory.STRICT_HOSTNAME_VERIFIER;
                        break;
                    case BROWSER_COMPATIBLE:
View Full Code Here


            if (sslSocketFactory == null) {
                final String[] supportedProtocols = systemProperties ? split(
                        System.getProperty("https.protocols")) : null;
                final String[] supportedCipherSuites = systemProperties ? split(
                        System.getProperty("https.cipherSuites")) : null;
                X509HostnameVerifier hostnameVerifier = this.hostnameVerifier;
                if (hostnameVerifier == null) {
                    hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
                }
                if (sslcontext != null) {
                    sslSocketFactory = new SSLConnectionSocketFactory(
View Full Code Here

        public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { }
        public X509Certificate[] getAcceptedIssuers() {
          return null;
        }
      };
      X509HostnameVerifier verifier = new X509HostnameVerifier() {
        public void verify(String string, SSLSocket ssls) throws IOException { }
        public void verify(String string, X509Certificate xc) throws SSLException { }
        public void verify(String string, String[] strings, String[] strings1) throws SSLException { }
        public boolean verify(String string, SSLSession ssls) {
          return true;
View Full Code Here

        httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
                proxy);
        if (supportSSL) {
            SSLSocketFactory sf = new SSLSocketFactory(
                    new TrustSelfSignedStrategy(),
                    new X509HostnameVerifier() {
                public boolean verify(String arg0, SSLSession arg1) {
                    return true;
                }

                public void verify(String host, String[] cns,
View Full Code Here

    }

    private DefaultHttpClient buildHttpClient() throws Exception {
        DefaultHttpClient httpClient = new DefaultHttpClient();
        SSLSocketFactory sf = new SSLSocketFactory(
                new TrustSelfSignedStrategy(), new X509HostnameVerifier() {
                    public boolean verify(String arg0, SSLSession arg1) {
                        return true;
                    }

                    public void verify(String host, String[] cns,
View Full Code Here

            };

            SSLContext sc = SSLContext.getInstance("SSL");
            sc.init(null, new TrustManager[]{trm}, null);

            X509HostnameVerifier hostnameVerifier = new X509HostnameVerifier() {
                public void verify(String host, SSLSocket ssl) throws IOException {
                }

                public void verify(String host, X509Certificate cert) throws SSLException {
                }
View Full Code Here

   protected ClientHttpEngine initDefaultEngine()
   {
      DefaultHttpClient httpClient = null;

      X509HostnameVerifier verifier = null;
      if (this.verifier != null) verifier = new VerifierWrapper(this.verifier);
      else
      {
         switch (policy)
         {
View Full Code Here

    try {
      // Set up SSL exceptions
      SchemeRegistry registry = new SchemeRegistry();
      SSLSocketFactory defaultSocketFactory = SSLSocketFactory.getSocketFactory();
      SSLContext context = SSLContext.getDefault();
      X509HostnameVerifier hostnameVerifier = new SelectiveHostnameVerifier(
          defaultSocketFactory.getHostnameVerifier(),
          settings.getSslHostExceptions());
      SSLSocketFactory socketFactory = new SSLSocketFactory(context,
          hostnameVerifier);
      registry.register(new Scheme("https", 443, socketFactory));
View Full Code Here

            if (sslSocketFactoryCopy == null) {
                final String[] supportedProtocols = systemProperties ? split(
                        System.getProperty("https.protocols")) : null;
                final String[] supportedCipherSuites = systemProperties ? split(
                        System.getProperty("https.cipherSuites")) : null;
                X509HostnameVerifier hostnameVerifierCopy = this.hostnameVerifier;
                if (hostnameVerifierCopy == null) {
                    hostnameVerifierCopy = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
                }
                if (sslcontext != null) {
                    sslSocketFactoryCopy = new SSLConnectionSocketFactory(
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

TOP

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

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.