Package javax.net.ssl

Examples of javax.net.ssl.HostnameVerifier


      List<String> trustKeys) throws PlatformLayerClientException {
    this.client = client;

    KeyManager keyManager = null;
    TrustManager trustManager = null;
    HostnameVerifier hostnameVerifier = null;

    if (trustKeys != null) {
      trustManager = new PublicKeyTrustManager(trustKeys);
      hostnameVerifier = new AcceptAllHostnameVerifier();
    }
View Full Code Here


    String cert = configuration.get("auth.system.tls.clientcert");

    CertificateAndKey certificateAndKey = encryptionStore.getCertificateAndKey(cert);

    HostnameVerifier hostnameVerifier = null;

    KeyManager keyManager = new SimpleClientCertificateKeyManager(certificateAndKey);

    TrustManager trustManager = null;
View Full Code Here

  @Override
  public PlatformLayerAuthenticationClient get() {
    String keystoneUserUrl = configuration.lookup("auth.user.url", "https://127.0.0.1:"
        + PORT_PLATFORMLAYER_AUTH_USER + "/v2.0/");

    HostnameVerifier hostnameVerifier = null;

    KeyManager keyManager = null;

    TrustManager trustManager = null;
View Full Code Here

  public PlatformlayerAuthenticator(HttpStrategy httpStrategy, String username, String password, String baseUrl,
      List<String> trustKeys) {
    this.username = username;
    this.password = password;

    HostnameVerifier hostnameVerifier = null;
    KeyManager keyManager = null;
    TrustManager trustManager = null;

    if (trustKeys != null) {
      trustManager = new PublicKeyTrustManager(trustKeys);
View Full Code Here

        HttpURLConnection conn = (HttpURLConnection) url.openConnection();

        if (this.isIgnoreSslCertificateHostname()) {
            if (conn instanceof HttpsURLConnection) {
                HttpsURLConnection secure = (HttpsURLConnection) conn;
                secure.setHostnameVerifier(new HostnameVerifier() {

                    @Override
                    public boolean verify(String hostname, SSLSession session) {
                        boolean result = true;
                        log("SSL verification ignored for current session and hostname: "
View Full Code Here

            public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType )
            {
            }
        } };

        HostnameVerifier hostnameVerifier = new HostnameVerifier()
        {
            public boolean verify( String urlHostName, SSLSession session )
            {
                Log.warn( "Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost() );
                return true;
View Full Code Here

        } else {
           // ssl socket factory already initialized, reuse it to benefit of keep alive
        }
       
       
        HostnameVerifier verifier;
        if (tlsClientParameters.isUseHttpsURLConnectionDefaultHostnameVerifier()) {
            verifier = HttpsURLConnection.getDefaultHostnameVerifier();
        } else if (tlsClientParameters.isDisableCNCheck()) {
            verifier = CertificateHostnameVerifier.ALLOW_ALL;
        } else {
View Full Code Here

      return sf;
   }

   protected void setHostnameVerifier(HttpsURLConnection conn, Map metadata)
   {
      HostnameVerifier hostnameVerifier = null;

      // First look for specific HostnameVerifier classname.
      String hostnameVerifierString = (String)metadata.get(HOSTNAME_VERIFIER);
      if (hostnameVerifierString == null || hostnameVerifierString.length() == 0)
         hostnameVerifierString = (String)configuration.get(HOSTNAME_VERIFIER);
View Full Code Here

        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
        env.put( "java.naming.security.credentials", "secret" );
        env.put( "java.naming.security.authentication", "simple" );
        LdapContext ctx = new InitialLdapContext( env, null );
        StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
            }
        } );
        tls.negotiate( BogusSSLContextFactory.getInstance( false ).getSocketFactory() );

        // create a new certificate
        String newIssuerDN = "cn=new_issuer_dn";
        String newSubjectDN = "cn=new_subject_dn";
        ServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
            new DN( "uid=admin,ou=system" ) );
        TlsKeyGenerator.addKeyPair( entry, newIssuerDN, newSubjectDN, "RSA" );

        // now update the certificate (over the wire)
        ModificationItem[] mods = new ModificationItem[3];
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.PRIVATE_KEY_AT, entry.get( TlsKeyGenerator.PRIVATE_KEY_AT ).getBytes() ) );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.PUBLIC_KEY_AT, entry.get( TlsKeyGenerator.PUBLIC_KEY_AT ).getBytes() ) );
        mods[2] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.USER_CERTIFICATE_AT, entry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ).getBytes() ) );
        ctx.modifyAttributes( "uid=admin,ou=system", mods );
        ctx.close();

        ldapServer.reloadSslContext();
       
        // create a new secure connection
        ctx = new InitialLdapContext( env, null );
        tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
            }
        } );
View Full Code Here

        // Start TLS
        LOG.debug( "About send startTls extended operation" );
        StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        LOG.debug( "Extended operation issued" );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
            }
        } );
View Full Code Here

TOP

Related Classes of javax.net.ssl.HostnameVerifier

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.