com.crashlytics.tools.android_2.1.0

ionSocketFactory getSystemSocketFactory()
    throws SSLInitializationException
  {
    return new SSLConnectionSocketFactory((SSLSocketFactory)SSLSocketFactory.getDefault(), split(System.getProperty("https.protocols")), split(System.getProperty("https.cipherSuites")), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLConnectionSocketFactory(SSLContext sslContext)
  {
    this(sslContext, BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLConnectionSocketFactory(SSLContext sslContext, X509HostnameVerifier hostnameVerifier)
  {
    this(((SSLContext)Args.notNull(sslContext, "SSL context")).getSocketFactory(), null, null, hostnameVerifier);
  }
  
  public SSLConnectionSocketFactory(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites, X509HostnameVerifier hostnameVerifier)
  {
    this(((SSLContext)Args.notNull(sslContext, "SSL context")).getSocketFactory(), supportedProtocols, supportedCipherSuites, hostnameVerifier);
  }
  
  public SSLConnectionSocketFactory(SSLSocketFactory socketfactory, X509HostnameVerifier hostnameVerifier)
  {
    this(socketfactory, null, null, hostnameVerifier);
  }
  
  public SSLConnectionSocketFactory(SSLSocketFactory socketfactory, String[] supportedProtocols, String[] supportedCipherSuites, X509HostnameVerifier hostnameVerifier)
  {
    Args.notNull(socketfactory, "SSL socket factory");
    this.socketfactory = socketfactory;
    this.supportedProtocols = supportedProtocols;
    this.supportedCipherSuites = supportedCipherSuites;
    this.hostnameVerifier = hostnameVerifier;
  }
  
  protected void prepareSocket(SSLSocket socket)
    throws IOException
  {}
  
  private void internalPrepareSocket(SSLSocket socket)
    throws IOException
  {
    if (supportedProtocols != null) {
      socket.setEnabledProtocols(supportedProtocols);
    }
    if (supportedCipherSuites != null) {
      socket.setEnabledCipherSuites(supportedCipherSuites);
    }
    prepareSocket(socket);
  }
  
  public Socket createSocket(HttpContext context)
    throws IOException
  {
    SSLSocket sock = (SSLSocket)socketfactory.createSocket();
    internalPrepareSocket(sock);
    return sock;
  }
  
  public Socket connectSocket(int connectTimeout, Socket socket, HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpContext context)
    throws IOException
  {
    Args.notNull(host, "HTTP host");
    Args.notNull(remoteAddress, "Remote address");
    Socket sock = socket != null ? socket : createSocket(context);
    if (localAddress != null) {
      sock.bind(localAddress);
    }
    try
    {
      sock.connect(remoteAddress, connectTimeout);
    }
    catch (IOException ex)
    {
      try
      {
        sock.close();
      }
      catch (IOException ignore) {}
      throw ex;
    }
    if ((sock instanceof SSLSocket))
    {
      SSLSocket sslsock = (SSLSocket)sock;
      sslsock.startHandshake();
      verifyHostname(sslsock, host.getHostName());
      return sock;
    }
    return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
  }
  
  public Socket createLayeredSocket(Socket socket, String target, int port, HttpContext context)
    throws IOException
  {
    SSLSocket sslsock = (SSLSocket)socketfactory.createSocket(socket, target, port, true);
    
    internalPrepareSocket(sslsock);
    sslsock.startHandshake();
    verifyHostname(sslsock, target);
    return sslsock;
  }
  
  private void verifyHostname(SSLSocket sslsock, String hostname)
    throws IOException
  {
    if (hostnameVerifier != null) {
      try
      {
        hostnameVerifier.verify(hostname, sslsock);
      }
      catch (IOException iox)
      {
        try
        {
          sslsock.close();
        }
        catch (Exception x) {}
        throw iox;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLConnectionSocketFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.net.Socket;
import java.security.Principal;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.X509KeyManager;

class SSLContextBuilder$KeyManagerDelegate
  implements X509KeyManager
{
  private final X509KeyManager keyManager;
  private final PrivateKeyStrategy aliasStrategy;
  
  SSLContextBuilder$KeyManagerDelegate(X509KeyManager keyManager, PrivateKeyStrategy aliasStrategy)
  {
    this.keyManager = keyManager;
    this.aliasStrategy = aliasStrategy;
  }
  
  public String[] getClientAliases(String keyType, Principal[] issuers)
  {
    return keyManager.getClientAliases(keyType, issuers);
  }
  
  public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket)
  {
    Map<String, PrivateKeyDetails> validAliases = new HashMap();
    for (String keyType : keyTypes)
    {
      String[] aliases = keyManager.getClientAliases(keyType, issuers);
      if (aliases != null) {
        for (String alias : aliases) {
          validAliases.put(alias, new PrivateKeyDetails(keyType, keyManager.getCertificateChain(alias)));
        }
      }
    }
    return aliasStrategy.chooseAlias(validAliases, socket);
  }
  
  public String[] getServerAliases(String keyType, Principal[] issuers)
  {
    return keyManager.getServerAliases(keyType, issuers);
  }
  
  public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
  {
    Map<String, PrivateKeyDetails> validAliases = new HashMap();
    String[] aliases = keyManager.getServerAliases(keyType, issuers);
    if (aliases != null) {
      for (String alias : aliases) {
        validAliases.put(alias, new PrivateKeyDetails(keyType, keyManager.getCertificateChain(alias)));
      }
    }
    return aliasStrategy.chooseAlias(validAliases, socket);
  }
  
  public X509Certificate[] getCertificateChain(String alias)
  {
    return keyManager.getCertificateChain(alias);
  }
  
  public PrivateKey getPrivateKey(String alias)
  {
    return keyManager.getPrivateKey(alias);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLContextBuilder.KeyManagerDelegate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;

class SSLContextBuilder$TrustManagerDelegate
  implements X509TrustManager
{
  private final X509TrustManager trustManager;
  private final TrustStrategy trustStrategy;
  
  SSLContextBuilder$TrustManagerDelegate(X509TrustManager trustManager, TrustStrategy trustStrategy)
  {
    this.trustManager = trustManager;
    this.trustStrategy = trustStrategy;
  }
  
  public void checkClientTrusted(X509Certificate[] chain, String authType)
    throws CertificateException
  {
    trustManager.checkClientTrusted(chain, authType);
  }
  
  public void checkServerTrusted(X509Certificate[] chain, String authType)
    throws CertificateException
  {
    if (!trustStrategy.isTrusted(chain, authType)) {
      trustManager.checkServerTrusted(chain, authType);
    }
  }
  
  public X509Certificate[] getAcceptedIssuers()
  {
    return trustManager.getAcceptedIssuers();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLContextBuilder.TrustManagerDelegate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.net.Socket;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.annotation.NotThreadSafe;

@NotThreadSafe
public class SSLContextBuilder
{
  static final String TLS = "TLS";
  static final String SSL = "SSL";
  private String protocol;
  private Set<KeyManager> keymanagers;
  private Set<TrustManager> trustmanagers;
  private SecureRandom secureRandom;
  
  public SSLContextBuilder()
  {
    keymanagers = new HashSet();
    trustmanagers = new HashSet();
  }
  
  public SSLContextBuilder useTLS()
  {
    protocol = "TLS";
    return this;
  }
  
  public SSLContextBuilder useSSL()
  {
    protocol = "SSL";
    return this;
  }
  
  public SSLContextBuilder useProtocol(String protocol)
  {
    this.protocol = protocol;
    return this;
  }
  
  public SSLContextBuilder setSecureRandom(SecureRandom secureRandom)
  {
    this.secureRandom = secureRandom;
    return this;
  }
  
  public SSLContextBuilder loadTrustMaterial(KeyStore truststore, TrustStrategy trustStrategy)
    throws NoSuchAlgorithmException, KeyStoreException
  {
    TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    
    tmfactory.init(truststore);
    TrustManager[] tms = tmfactory.getTrustManagers();
    if (tms != null)
    {
      if (trustStrategy != null) {
        for (int i = 0; i < tms.length; i++)
        {
          TrustManager tm = tms[i];
          if ((tm instanceof X509TrustManager)) {
            tms[i] = new TrustManagerDelegate((X509TrustManager)tm, trustStrategy);
          }
        }
      }
      for (int i = 0; i < tms.length; i++) {
        trustmanagers.add(tms[i]);
      }
    }
    return this;
  }
  
  public SSLContextBuilder loadTrustMaterial(KeyStore truststore)
    throws NoSuchAlgorithmException, KeyStoreException
  {
    return loadTrustMaterial(truststore, null);
  }
  
  public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword)
    throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
  {
    loadKeyMaterial(keystore, keyPassword, null);
    return this;
  }
  
  public SSLContextBuilder loadKeyMaterial(KeyStore keystore, char[] keyPassword, PrivateKeyStrategy aliasStrategy)
    throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
  {
    KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
    
    kmfactory.init(keystore, keyPassword);
    KeyManager[] kms = kmfactory.getKeyManagers();
    if (kms != null)
    {
      if (aliasStrategy != null) {
        for (int i = 0; i < kms.length; i++)
        {
          KeyManager km = kms[i];
          if ((km instanceof X509KeyManager)) {
            kms[i] = new KeyManagerDelegate((X509KeyManager)km, aliasStrategy);
          }
        }
      }
      for (int i = 0; i < kms.length; i++) {
        keymanagers.add(kms[i]);
      }
    }
    return this;
  }
  
  public SSLContext build()
    throws NoSuchAlgorithmException, KeyManagementException
  {
    SSLContext sslcontext = SSLContext.getInstance(protocol != null ? protocol : "TLS");
    
    sslcontext.init(!keymanagers.isEmpty() ? (KeyManager[])keymanagers.toArray(new KeyManager[keymanagers.size()]) : null, !trustmanagers.isEmpty() ? (TrustManager[])trustmanagers.toArray(new TrustManager[trustmanagers.size()]) : null, secureRandom);
    
    return sslcontext;
  }
  
  static class TrustManagerDelegate
    implements X509TrustManager
  {
    private final X509TrustManager trustManager;
    private final TrustStrategy trustStrategy;
    
    TrustManagerDelegate(X509TrustManager trustManager, TrustStrategy trustStrategy)
    {
      this.trustManager = trustManager;
      this.trustStrategy = trustStrategy;
    }
    
    public void checkClientTrusted(X509Certificate[] chain, String authType)
      throws CertificateException
    {
      trustManager.checkClientTrusted(chain, authType);
    }
    
    public void checkServerTrusted(X509Certificate[] chain, String authType)
      throws CertificateException
    {
      if (!trustStrategy.isTrusted(chain, authType)) {
        trustManager.checkServerTrusted(chain, authType);
      }
    }
    
    public X509Certificate[] getAcceptedIssuers()
    {
      return trustManager.getAcceptedIssuers();
    }
  }
  
  static class KeyManagerDelegate
    implements X509KeyManager
  {
    private final X509KeyManager keyManager;
    private final PrivateKeyStrategy aliasStrategy;
    
    KeyManagerDelegate(X509KeyManager keyManager, PrivateKeyStrategy aliasStrategy)
    {
      this.keyManager = keyManager;
      this.aliasStrategy = aliasStrategy;
    }
    
    public String[] getClientAliases(String keyType, Principal[] issuers)
    {
      return keyManager.getClientAliases(keyType, issuers);
    }
    
    public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket)
    {
      Map<String, PrivateKeyDetails> validAliases = new HashMap();
      for (String keyType : keyTypes)
      {
        String[] aliases = keyManager.getClientAliases(keyType, issuers);
        if (aliases != null) {
          for (String alias : aliases) {
            validAliases.put(alias, new PrivateKeyDetails(keyType, keyManager.getCertificateChain(alias)));
          }
        }
      }
      return aliasStrategy.chooseAlias(validAliases, socket);
    }
    
    public String[] getServerAliases(String keyType, Principal[] issuers)
    {
      return keyManager.getServerAliases(keyType, issuers);
    }
    
    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
    {
      Map<String, PrivateKeyDetails> validAliases = new HashMap();
      String[] aliases = keyManager.getServerAliases(keyType, issuers);
      if (aliases != null) {
        for (String alias : aliases) {
          validAliases.put(alias, new PrivateKeyDetails(keyType, keyManager.getCertificateChain(alias)));
        }
      }
      return aliasStrategy.chooseAlias(validAliases, socket);
    }
    
    public X509Certificate[] getCertificateChain(String alias)
    {
      return keyManager.getCertificateChain(alias);
    }
    
    public PrivateKey getPrivateKey(String alias)
    {
      return keyManager.getPrivateKey(alias);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLContextBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import org.apache.http.annotation.Immutable;

@Immutable
public class SSLContexts
{
  public static SSLContext createDefault()
    throws SSLInitializationException
  {
    try
    {
      SSLContext sslcontext = SSLContext.getInstance("TLS");
      sslcontext.init(null, null, null);
      return sslcontext;
    }
    catch (NoSuchAlgorithmException ex)
    {
      throw new SSLInitializationException(ex.getMessage(), ex);
    }
    catch (KeyManagementException ex)
    {
      throw new SSLInitializationException(ex.getMessage(), ex);
    }
  }
  
  public static SSLContext createSystemDefault()
    throws SSLInitializationException
  {
    try
    {
      return SSLContext.getInstance("Default");
    }
    catch (NoSuchAlgorithmException ex) {}
    return createDefault();
  }
  
  public static SSLContextBuilder custom()
  {
    return new SSLContextBuilder();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLContexts
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

public class SSLInitializationException
  extends IllegalStateException
{
  private static final long serialVersionUID = -8243587425648536702L;
  
  public SSLInitializationException(String message, Throwable cause)
  {
    super(message, cause);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLInitializationException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import org.apache.http.HttpHost;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.HttpInetSocketAddress;
import org.apache.http.conn.scheme.HostNameResolver;
import org.apache.http.conn.scheme.LayeredSchemeSocketFactory;
import org.apache.http.conn.scheme.LayeredSocketFactory;
import org.apache.http.conn.scheme.SchemeLayeredSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Args;
import org.apache.http.util.Asserts;
import org.apache.http.util.TextUtils;

@Deprecated
@ThreadSafe
public class SSLSocketFactory
  implements LayeredConnectionSocketFactory, SchemeLayeredSocketFactory, LayeredSchemeSocketFactory, LayeredSocketFactory
{
  public static final String TLS = "TLS";
  public static final String SSL = "SSL";
  public static final String SSLV2 = "SSLv2";
  public static final X509HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER = new AllowAllHostnameVerifier();
  public static final X509HostnameVerifier BROWSER_COMPATIBLE_HOSTNAME_VERIFIER = new BrowserCompatHostnameVerifier();
  public static final X509HostnameVerifier STRICT_HOSTNAME_VERIFIER = new StrictHostnameVerifier();
  private final javax.net.ssl.SSLSocketFactory socketfactory;
  private final HostNameResolver nameResolver;
  private volatile X509HostnameVerifier hostnameVerifier;
  private final String[] supportedProtocols;
  private final String[] supportedCipherSuites;
  
  public static SSLSocketFactory getSocketFactory()
    throws SSLInitializationException
  {
    return new SSLSocketFactory(SSLContexts.createDefault(), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  private static String[] split(String s)
  {
    if (TextUtils.isBlank(s)) {
      return null;
    }
    return s.split(" *, *");
  }
  
  public static SSLSocketFactory getSystemSocketFactory()
    throws SSLInitializationException
  {
    return new SSLSocketFactory((javax.net.ssl.SSLSocketFactory)javax.net.ssl.SSLSocketFactory.getDefault(), split(System.getProperty("https.protocols")), split(System.getProperty("https.cipherSuites")), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(String algorithm, KeyStore keystore, String keyPassword, KeyStore truststore, SecureRandom random, HostNameResolver nameResolver)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().useProtocol(algorithm).setSecureRandom(random).loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null).loadTrustMaterial(truststore).build(), nameResolver);
  }
  
  public SSLSocketFactory(String algorithm, KeyStore keystore, String keyPassword, KeyStore truststore, SecureRandom random, TrustStrategy trustStrategy, X509HostnameVerifier hostnameVerifier)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().useProtocol(algorithm).setSecureRandom(random).loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null).loadTrustMaterial(truststore, trustStrategy).build(), hostnameVerifier);
  }
  
  public SSLSocketFactory(String algorithm, KeyStore keystore, String keyPassword, KeyStore truststore, SecureRandom random, X509HostnameVerifier hostnameVerifier)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().useProtocol(algorithm).setSecureRandom(random).loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null).loadTrustMaterial(truststore).build(), hostnameVerifier);
  }
  
  public SSLSocketFactory(KeyStore keystore, String keystorePassword, KeyStore truststore)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().loadKeyMaterial(keystore, keystorePassword != null ? keystorePassword.toCharArray() : null).loadTrustMaterial(truststore).build(), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(KeyStore keystore, String keystorePassword)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().loadKeyMaterial(keystore, keystorePassword != null ? keystorePassword.toCharArray() : null).build(), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(KeyStore truststore)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().loadTrustMaterial(truststore).build(), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(TrustStrategy trustStrategy, X509HostnameVerifier hostnameVerifier)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().loadTrustMaterial(null, trustStrategy).build(), hostnameVerifier);
  }
  
  public SSLSocketFactory(TrustStrategy trustStrategy)
    throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
  {
    this(SSLContexts.custom().loadTrustMaterial(null, trustStrategy).build(), BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(SSLContext sslContext)
  {
    this(sslContext, BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
  }
  
  public SSLSocketFactory(SSLContext sslContext, HostNameResolver nameResolver)
  {
    socketfactory = sslContext.getSocketFactory();
    hostnameVerifier = BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
    this.nameResolver = nameResolver;
    supportedProtocols = null;
    supportedCipherSuites = null;
  }
  
  public SSLSocketFactory(SSLContext sslContext, X509HostnameVerifier hostnameVerifier)
  {
    this(((SSLContext)Args.notNull(sslContext, "SSL context")).getSocketFactory(), null, null, hostnameVerifier);
  }
  
  public SSLSocketFactory(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites, X509HostnameVerifier hostnameVerifier)
  {
    this(((SSLContext)Args.notNull(sslContext, "SSL context")).getSocketFactory(), supportedProtocols, supportedCipherSuites, hostnameVerifier);
  }
  
  public SSLSocketFactory(javax.net.ssl.SSLSocketFactory socketfactory, X509HostnameVerifier hostnameVerifier)
  {
    this(socketfactory, null, null, hostnameVerifier);
  }
  
  public SSLSocketFactory(javax.net.ssl.SSLSocketFactory socketfactory, String[] supportedProtocols, String[] supportedCipherSuites, X509HostnameVerifier hostnameVerifier)
  {
    Args.notNull(socketfactory, "SSL socket factory");
    this.socketfactory = socketfactory;
    this.supportedProtocols = supportedProtocols;
    this.supportedCipherSuites = supportedCipherSuites;
    this.hostnameVerifier = hostnameVerifier;
    nameResolver = null;
  }
  
  public Socket createSocket(HttpParams params)
    throws IOException
  {
    return createSocket((HttpContext)null);
  }
  
  public Socket createSocket()
    throws IOException
  {
    return createSocket((HttpContext)null);
  }
  
  public Socket connectSocket(Socket socket, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpParams params)
    throws IOException, UnknownHostException, ConnectTimeoutException
  {
    Args.notNull(remoteAddress, "Remote address");
    Args.notNull(params, "HTTP parameters");
    HttpHost host;
    HttpHost host;
    if ((remoteAddress instanceof HttpInetSocketAddress)) {
      host = ((HttpInetSocketAddress)remoteAddress).getHttpHost();
    } else {
      host = new HttpHost(remoteAddress.getHostName(), remoteAddress.getPort(), "https");
    }
    int connectTimeout = HttpConnectionParams.getConnectionTimeout(params);
    return connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, null);
  }
  
  public boolean isSecure(Socket sock)
    throws IllegalArgumentException
  {
    Args.notNull(sock, "Socket");
    Asserts.check(sock instanceof SSLSocket, "Socket not created by this factory");
    Asserts.check(!sock.isClosed(), "Socket is closed");
    return true;
  }
  
  public Socket createLayeredSocket(Socket socket, String host, int port, HttpParams params)
    throws IOException, UnknownHostException
  {
    return createLayeredSocket(socket, host, port, (HttpContext)null);
  }
  
  public Socket createLayeredSocket(Socket socket, String host, int port, boolean autoClose)
    throws IOException, UnknownHostException
  {
    return createLayeredSocket(socket, host, port, (HttpContext)null);
  }
  
  public void setHostnameVerifier(X509HostnameVerifier hostnameVerifier)
  {
    Args.notNull(hostnameVerifier, "Hostname verifier");
    this.hostnameVerifier = hostnameVerifier;
  }
  
  public X509HostnameVerifier getHostnameVerifier()
  {
    return hostnameVerifier;
  }
  
  public Socket connectSocket(Socket socket, String host, int port, InetAddress local, int localPort, HttpParams params)
    throws IOException, UnknownHostException, ConnectTimeoutException
  {
    InetAddress remote;
    InetAddress remote;
    if (nameResolver != null) {
      remote = nameResolver.resolve(host);
    } else {
      remote = InetAddress.getByName(host);
    }
    InetSocketAddress localAddress = null;
    if ((local != null) || (localPort > 0)) {
      localAddress = new InetSocketAddress(local, localPort > 0 ? localPort : 0);
    }
    InetSocketAddress remoteAddress = new HttpInetSocketAddress(new HttpHost(host, port), remote, port);
    
    return connectSocket(socket, remoteAddress, localAddress, params);
  }
  
  public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
    throws IOException, UnknownHostException
  {
    return createLayeredSocket(socket, host, port, autoClose);
  }
  
  protected void prepareSocket(SSLSocket socket)
    throws IOException
  {}
  
  private void internalPrepareSocket(SSLSocket socket)
    throws IOException
  {
    if (supportedProtocols != null) {
      socket.setEnabledProtocols(supportedProtocols);
    }
    if (supportedCipherSuites != null) {
      socket.setEnabledCipherSuites(supportedCipherSuites);
    }
    prepareSocket(socket);
  }
  
  public Socket createSocket(HttpContext context)
    throws IOException
  {
    SSLSocket sock = (SSLSocket)socketfactory.createSocket();
    internalPrepareSocket(sock);
    return sock;
  }
  
  public Socket connectSocket(int connectTimeout, Socket socket, HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpContext context)
    throws IOException
  {
    Args.notNull(host, "HTTP host");
    Args.notNull(remoteAddress, "Remote address");
    Socket sock = socket != null ? socket : createSocket(context);
    if (localAddress != null) {
      sock.bind(localAddress);
    }
    try
    {
      sock.connect(remoteAddress, connectTimeout);
    }
    catch (IOException ex)
    {
      try
      {
        sock.close();
      }
      catch (IOException ignore) {}
      throw ex;
    }
    if ((sock instanceof SSLSocket))
    {
      SSLSocket sslsock = (SSLSocket)sock;
      sslsock.startHandshake();
      verifyHostname(sslsock, host.getHostName());
      return sock;
    }
    return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
  }
  
  public Socket createLayeredSocket(Socket socket, String target, int port, HttpContext context)
    throws IOException
  {
    SSLSocket sslsock = (SSLSocket)socketfactory.createSocket(socket, target, port, true);
    
    internalPrepareSocket(sslsock);
    sslsock.startHandshake();
    verifyHostname(sslsock, target);
    return sslsock;
  }
  
  private void verifyHostname(SSLSocket sslsock, String hostname)
    throws IOException
  {
    if (hostnameVerifier != null) {
      try
      {
        hostnameVerifier.verify(hostname, sslsock);
      }
      catch (IOException iox)
      {
        try
        {
          sslsock.close();
        }
        catch (Exception x) {}
        throw iox;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.SSLSocketFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import javax.net.ssl.SSLException;
import org.apache.http.annotation.Immutable;

@Immutable
public class StrictHostnameVerifier
  extends AbstractVerifier
{
  public final void verify(String host, String[] cns, String[] subjectAlts)
    throws SSLException
  {
    verify(host, cns, subjectAlts, true);
  }
  
  public final String toString()
  {
    return "STRICT";
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.StrictHostnameVerifier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

public class TrustSelfSignedStrategy
  implements TrustStrategy
{
  public boolean isTrusted(X509Certificate[] chain, String authType)
    throws CertificateException
  {
    return chain.length == 1;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.TrustSelfSignedStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

public abstract interface TrustStrategy
{
  public abstract boolean isTrusted(X509Certificate[] paramArrayOfX509Certificate, String paramString)
    throws CertificateException;
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.TrustStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.ssl;

import java.io.IOException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;

public abstract interface X509HostnameVerifier
  extends HostnameVerifier
{
  public abstract void verify(String paramString, SSLSocket paramSSLSocket)
    throws IOException;
  
  public abstract void verify(String paramString, X509Certificate paramX509Certificate)
    throws SSLException;
  
  public abstract void verify(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2)
    throws SSLException;
}

/* Location:
 * Qualified Name:     org.apache.http.conn.ssl.X509HostnameVerifier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.conn.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.annotation.Immutable;

@Immutable
public class InetAddressUtils
{
  private static final String IPV4_BASIC_PATTERN_STRING = "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])";
  private static final Pattern IPV4_PATTERN = Pattern.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");
  private static final Pattern IPV4_MAPPED_IPV6_PATTERN = Pattern.compile("^::[fF]{4}:(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");
  private static final Pattern IPV6_STD_PATTERN = Pattern.compile("^[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}$");
  private static final Pattern IPV6_HEX_COMPRESSED_PATTERN = Pattern.compile("^(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)::(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)$");
  private static final char COLON_CHAR = ':';
  private static final int MAX_COLON_COUNT = 7;
  
  public static boolean isIPv4Address(String input)
  {
    return IPV4_PATTERN.matcher(input).matches();
  }
  
  public static boolean isIPv4MappedIPv64Address(String input)
  {
    return IPV4_MAPPED_IPV6_PATTERN.matcher(input).matches();
  }
  
  public static boolean isIPv6StdAddress(String input)
  {
    return IPV6_STD_PATTERN.matcher(input).matches();
  }
  
  public static boolean isIPv6HexCompressedAddress(String input)
  {
    int colonCount = 0;
    for (int i = 0; i < input.length(); i++) {
      if (input.charAt(i) == ':') {
        colonCount++;
      }
    }
    return (colonCount <= 7) && (IPV6_HEX_COMPRESSED_PATTERN.matcher(input).matches());
  }
  
  public static boolean isIPv6Address(String input)
  {
    return (isIPv6StdAddress(input)) || (isIPv6HexCompressedAddress(input));
  }
}

/* Location:
 * Qualified Name:     org.apache.http.conn.util.InetAddressUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

public abstract interface ClientCookie
  extends Cookie
{
  public static final String VERSION_ATTR = "version";
  public static final String PATH_ATTR = "path";
  public static final String DOMAIN_ATTR = "domain";
  public static final String MAX_AGE_ATTR = "max-age";
  public static final String SECURE_ATTR = "secure";
  public static final String COMMENT_ATTR = "comment";
  public static final String EXPIRES_ATTR = "expires";
  public static final String PORT_ATTR = "port";
  public static final String COMMENTURL_ATTR = "commenturl";
  public static final String DISCARD_ATTR = "discard";
  
  public abstract String getAttribute(String paramString);
  
  public abstract boolean containsAttribute(String paramString);
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.ClientCookie
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import java.util.Date;

public abstract interface Cookie
{
  public abstract String getName();
  
  public abstract String getValue();
  
  public abstract String getComment();
  
  public abstract String getCommentURL();
  
  public abstract Date getExpiryDate();
  
  public abstract boolean isPersistent();
  
  public abstract String getDomain();
  
  public abstract String getPath();
  
  public abstract int[] getPorts();
  
  public abstract boolean isSecure();
  
  public abstract int getVersion();
  
  public abstract boolean isExpired(Date paramDate);
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.Cookie
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

public abstract interface CookieAttributeHandler
{
  public abstract void parse(SetCookie paramSetCookie, String paramString)
    throws MalformedCookieException;
  
  public abstract void validate(Cookie paramCookie, CookieOrigin paramCookieOrigin)
    throws MalformedCookieException;
  
  public abstract boolean match(Cookie paramCookie, CookieOrigin paramCookieOrigin);
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.CookieAttributeHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import java.io.Serializable;
import java.util.Comparator;
import org.apache.http.annotation.Immutable;

@Immutable
public class CookieIdentityComparator
  implements Serializable, Comparator<Cookie>
{
  private static final long serialVersionUID = 4466565437490631532L;
  
  public int compare(Cookie c1, Cookie c2)
  {
    int res = c1.getName().compareTo(c2.getName());
    if (res == 0)
    {
      String d1 = c1.getDomain();
      if (d1 == null) {
        d1 = "";
      } else if (d1.indexOf('.') == -1) {
        d1 = d1 + ".local";
      }
      String d2 = c2.getDomain();
      if (d2 == null) {
        d2 = "";
      } else if (d2.indexOf('.') == -1) {
        d2 = d2 + ".local";
      }
      res = d1.compareToIgnoreCase(d2);
    }
    if (res == 0)
    {
      String p1 = c1.getPath();
      if (p1 == null) {
        p1 = "/";
      }
      String p2 = c2.getPath();
      if (p2 == null) {
        p2 = "/";
      }
      res = p1.compareTo(p2);
    }
    return res;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.CookieIdentityComparator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import java.util.Locale;
import org.apache.http.annotation.Immutable;
import org.apache.http.util.Args;

@Immutable
public final class CookieOrigin
{
  private final String host;
  private final int port;
  private final String path;
  private final boolean secure;
  
  public CookieOrigin(String host, int port, String path, boolean secure)
  {
    Args.notBlank(host, "Host");
    Args.notNegative(port, "Port");
    Args.notNull(path, "Path");
    this.host = host.toLowerCase(Locale.ENGLISH);
    this.port = port;
    if (path.trim().length() != 0) {
      this.path = path;
    } else {
      this.path = "/";
    }
    this.secure = secure;
  }
  
  public String getHost()
  {
    return host;
  }
  
  public String getPath()
  {
    return path;
  }
  
  public int getPort()
  {
    return port;
  }
  
  public boolean isSecure()
  {
    return secure;
  }
  
  public String toString()
  {
    StringBuilder buffer = new StringBuilder();
    buffer.append('[');
    if (secure) {
      buffer.append("(secure)");
    }
    buffer.append(host);
    buffer.append(':');
    buffer.append(Integer.toString(port));
    buffer.append(path);
    buffer.append(']');
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.CookieOrigin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import java.io.Serializable;
import java.util.Comparator;
import org.apache.http.annotation.Immutable;

@Immutable
public class CookiePathComparator
  implements Serializable, Comparator<Cookie>
{
  private static final long serialVersionUID = 7523645369616405818L;
  
  private String normalizePath(Cookie cookie)
  {
    String path = cookie.getPath();
    if (path == null) {
      path = "/";
    }
    if (!path.endsWith("/")) {
      path = path + '/';
    }
    return path;
  }
  
  public int compare(Cookie c1, Cookie c2)
  {
    String path1 = normalizePath(c1);
    String path2 = normalizePath(c2);
    if (path1.equals(path2)) {
      return 0;
    }
    if (path1.startsWith(path2)) {
      return -1;
    }
    if (path2.startsWith(path1)) {
      return 1;
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.CookiePathComparator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import org.apache.http.annotation.Immutable;

@Immutable
public class CookieRestrictionViolationException
  extends MalformedCookieException
{
  private static final long serialVersionUID = 7371235577078589013L;
  
  public CookieRestrictionViolationException() {}
  
  public CookieRestrictionViolationException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.cookie.CookieRestrictionViolationException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.cookie;

import java.util.List;
import org.apache.http.Header;

public abstract interface CookieSpec
{
  public abstract int getVersion();
  
  public abstract List<
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd