无法验证证书签名? [英] Could not validate certificate signature?

查看:1164
本文介绍了无法验证证书签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的是SSL Socket和的TrustManager从这个方面的自签名的SSL

但我不断收到以下错误:


  

19 09-28:52:41.942:WARN / System.err的(10101):javax.net.ssl​​.SSLHandshakeException:org.bouncycastle.jce.exception.ExtCertPathValidatorException:无法验证证书签名


什么是错的?
我已经检查了计算器不同的岗位,但我不能老是似乎得到它的工作。
大侧BTW:)

感谢您提前。

我的code:

  SchemeRegistry schemeRegistry =新SchemeRegistry();// http方案schemeRegistry.register(新计划(HTTP,PlainSocketFactory.getSocketFactory(),80));// HTTPS方案schemeRegistry.register(新计划(https开头,新EasySSLSocketFactory(),443));
PARAMS =新BasicHttpParams();
params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS,1);
params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE,新ConnPerRouteBean(1));
params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE,FALSE);
HttpProtocolParams.setVersion(参数,可以HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(参数,可以UTF8);
CredentialsProvider credentialsProvider =新BasicCredentialsProvider();
credentialsProvider.setCredentials(新AuthScope(www.xxx.com,AuthScope.ANY_PORT)
    新UsernamePasswordCredentials(用户,密码));
clientConnectionManager =新ThreadSafeClientConnManager(参数,可以schemeRegistry);
上下文=新BasicHttpContext();
context.setAttribute(http.auth.credentials提供商,credentialsProvider);DefaultHttpClient客户端=新DefaultHttpClient(clientConnectionManager,则params);HTTPGET GET =新HTTPGET(https://www.xxx.com/web/restricted/form/formelement=512663);
HTT presponse响应= client.execute(GET,背景);Log.w(响应,状态行:+ response.toString());


解决方案

正如迈克尔·利维提到的,我得到这个异​​常的原因是,我已经离开了我的Andr​​oid模拟器开了几天,时钟已经得到了pretty远远不同步。一旦我重新启动模拟器,异常走。

I use the SSL Socket and Trustmanager from this side Self signed SSL

but i keep getting following error:

09-28 19:52:41.942: WARN/System.err(10101): javax.net.ssl.SSLHandshakeException: org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate signature.

What is wrong? I already checked different posts on stackoverflow but i can`t seem to get it to work. Great side btw :)

Thank you in advance.

My code:

SchemeRegistry schemeRegistry = new SchemeRegistry();

// http scheme

schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));

// https scheme

schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443));
params = new BasicHttpParams();
params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(1));
params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "utf8");
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(new AuthScope("www.xxx.com", AuthScope.ANY_PORT),
    new UsernamePasswordCredentials("user", "password"));
clientConnectionManager = new ThreadSafeClientConnManager(params, schemeRegistry);
context = new BasicHttpContext();
context.setAttribute("http.auth.credentials-provider", credentialsProvider);

DefaultHttpClient client = new DefaultHttpClient(clientConnectionManager, params);

HttpGet get = new HttpGet("https://www.xxx.com/web/restricted/form/formelement=512663");
HttpResponse response = client.execute(get, context);

Log.w("Response ","Status line : "+ response.toString());

解决方案

As Michael Levy mentioned, the reason I was getting this exception is that I had left my Android Emulator open for a few days and the clock had gotten pretty far out of sync. Once I restarted the emulator, the exception went away.

这篇关于无法验证证书签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆