相关疑难解决方法(0)

Android上的Apache HttpClient生成CertPathValidatorException(IssuerName!= SubjectName)

我正在开发一个Android应用程序来访问一些battle.net(https://eu.battle.net)帐户数据(对于魔兽世界),我正在使用org.apache.http.client.HttpClient这样做.

这是我正在使用的代码:

 public static final String USER_AGENT = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)";

  public static class MyHttpClient extends DefaultHttpClient {

    final Context context;

    public MyHttpClient(Context context) {
      super();
      this.context = context;
    }

    @Override
    protected ClientConnectionManager createClientConnectionManager() {
      SchemeRegistry registry = new SchemeRegistry();
      registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
      // Register for port 443 our SSLSocketFactory with our keystore
      // to the ConnectionManager
      registry.register(new Scheme("https", newSslSocketFactory(), 443));
      return new SingleClientConnManager(getParams(), registry); …
Run Code Online (Sandbox Code Playgroud)

ssl android world-of-warcraft apache-commons-httpclient

33
推荐指数
2
解决办法
3万
查看次数