//Load Two Keystores
KeyStore keystore = KeyStore.getInstance("pkcs12", "SunJSSE");
InputStream keystoreInput = new FileInputStream(cerPath);
keystore.load(keystoreInput, passwd.toCharArray());
System.out.println("Keystore has " + keystore.size() + " keys");
// load the truststore, leave it null to rely on cacerts distributed with the JVM
KeyStore truststore = KeyStore.getInstance("pkcs12", "SunJSSE");
InputStream truststoreInput = new FileInputStream(cerPath);
truststore.load(truststoreInput, passwd.toCharArray());
System.out.println("Truststore has " + truststore.size() + " keys");
//ssl context
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, null, null);
SSLSocketFactory sf = new SSLSocketFactory(keystore, passwd);
Scheme https = new Scheme("https", 443, sf);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(https);
...
client = new DefaultHttpClient(new PoolingClientConnectionManager(schemeRegistry));
...
HttpResponse httpResponse = client.execute( targetHost, httpMethod);
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No X509TrustManager implementation available
普通的SSL属性()也不起作用。
最后我们发现了问题。
我们在pom.xml中有一个指向框架wiremock的依赖项:
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>1.43</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
这个框架在jar中包含一个/keystore文件,该文件产生了这个问题。当我们从pom中移除这个依赖项时,所有工作都很好。
问题内容: 我在Google Play中有一个应用,我收到了来自Google的邮件,内容是: 此电子邮件末尾列出的您的应用使用了X509TrustManager界面的不安全实现。具体而言,在与远程主机建立HTTPS连接时,该实现会忽略所有SSL证书验证错误,从而使您的应用容易受到中间人攻击。 为了正确处理SSL证书验证,只要服务器提供的证书不符合您的期望,请在自定义X509TrustManager
我用Ribbon和Netflix Eureka创建了一个简单的项目。尤里卡运作良好,我可以看到所有注册服务。但是,Ribbon负载平衡器看不到这些服务。实际上,在它打印的日志中,它在“当前服务器列表”中看到了服务器,但是我得到一个例外,没有找到任何实例。如果能给我一些提示,我将不胜感激,我花了很多时间(甚至几天)才弄明白。 日志(我用
我需要忽略PKIX路径构建异常 我知道如何通过编写自己的类来实现,我总是。 但是,我不想信任所有的服务器 我希望所有的默认验证都能像现在一样为客户端完成 对于服务器,我只想忽略一个特定证书的服务器证书验证,但我想继续验证它,就像目前一样(例如使用cacerts store) 我如何实现这样的目标——即在替换X509TrustFactory对象之前,将部分验证传递给它。 即这就是我想做的 此外,我不
我需要在SE环境中使用没有CDI容器的Jersey 2.28(带Jetty)。我的所有设置都在web.xml中: 以下是我使用的依赖项: 我得到的是: 我知道Jersey可以与不同的DI容器一起使用,例如Weld、HK2等,但是否可以不使用DI容器?如果是,那又是怎样做的呢?
问题内容: 在Linux下,我一直在检查matplotlib的动画类,并且它似乎可以工作,除了我无法初始化电影编写者来编写电影。 使用以下任一示例: http://matplotlib.org/examples/animation/moviewriter.html http://matplotlib.org/examples/animation/basic_example_writer.html
在Java8中,我们有类stream ,奇怪的是,它有一个方法 所以您希望它实现interface Iterable ,这恰恰需要这个方法,但事实并非如此。 当我想使用foreach循环对流进行迭代时,我必须执行如下操作 我是不是漏了什么?