Tag: sslhandshakeexception

SSLHandshakeException:握手期间远程主机关闭连接

论坛充满了这个问题,但我找不到解决方案。 我尝试连接WS但没有任何成功。 我试图更新cacerts文件没有任何效果。 日志是: Allow unsafe renegotiation: false Allow legacy hello messages: true Is initial handshake: true Is secure renegotiation: false %% No cached client session *** ClientHello, TLSv1 RandomCookie: GMT: 1507108654 bytes = { 133, 135, 81, 148, 186, 186, 146, 23, 28, 240, 158, 152, 139, 167, 209, 225, 54, 253, 112, 118, […]

某些站点上的Java 8 https连接失败

我无法访问某些https资源。 请帮助使https呼叫可靠。 我在这里测试的示例来自Firefox浏览器,以确保它们正常工作。 $ java -version openjdk version “1.8.0_121” OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-1~bpo8+1-b13) OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode) 我还检查了https连接工作的网站和其他失败的错误(此处的错误示例)似乎使用相同的连接加密: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,128位密钥,TLS 1.2 我需要从位于不同域和服务器上的少数Web服务收集数据。 其中一些设置为http,一些设置为https。 我没有收集任何安全信息,只需要获取网页内容。 所以我相信所有人: public class SSLSetupService { /* * Turn SSL certificate check off */ public void trustAll(){ // Create a trust manager that does not validate certificate chains […]

无法找到所请求目标的有效证书路径 – java

我正在尝试使用HttpClient对象连接到网站。 它适用于我们通常使用的网站(如谷歌)。 但是有一个网站,当我尝试连接时,我的程序给出了这个错误.. javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1369) ……………….. Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) at sun.security.validator.Validator.validate(Validator.java:260) …………… Caused […]

SSL握手exception:SSL库中的失败,通常是协议错误

我正在使用带有android v4.4.2(Java)和java_websockets的物理设备,并且在尝试连接到websocket时出现此错误。 javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7aa38588: Failure in SSL library, usually a protocol error error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO: unknown protocol (external/openssl/ssl/s23_clnt.c:769 0x73a81cfc:0x00000000) 我找到了这个答案 ,我尝试实现它,但没有任何改变。 这是我获得NoSSLv3SocketFactory代码的NoSSLv3SocketFactory 。 它进入try catch直到最后一行mWebSocketClient.connect()但它没有进入catch, onError记录错误。 这是websocket设置代码。 … String complete = wsBase + ep; URI uri = new URI(complete); mWebSocketClient = new WebSocketClient(uri, new Draft_17()) { @Override public void onOpen(ServerHandshake serverHandshake) { […]

无法使用java连接到HTTPS URL

我想用java读取安全URL(HTTPS)。 我正在尝试以下方面。 它给了我 public static void main(String[] arg) { try { URL url = new URL(“http://www.google.com”); System.out.println(“Connecting to www.google.com”); URLConnection ucon = url.openConnection(); System.out.println(“Connectied to www.google.com”); System.out.println(“Retrieving contents from www.google.com”); String htmlContents = getResponseData(ucon); System.out.println(“Retrieved contents from Yahoo! as follows”); System.out.println(htmlContents); } catch (Exception e) { e.printStackTrace(); } } 这给了我以下输出。 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building […]

握手在棒棒糖上失败

我正在尝试进行HTTP POST,但我得到两个不同的错误: javax.net.ssl.SSLHandshakeException: Handshake failed net.ssl.SSLPeerUnverifiedException: No peer certificate 我通过此处指定的解决方法修复了无对等证书错误: https : //stackoverflow.com/a/4837230/4254419 但是虽然它修复了错误,但它会抛出一个新错误,这就是握手失败 我知道这不安全而且我不在乎,它不适合生产,所以我更不关心安全性。 这个问题有解决方法吗?

Restlet javax.net.ssl.SSLHandshakeException:null cert chain

我正在本地测试客户端和服务器之间的SSL通信。 所以我使用OpenSSL命令生成证书。 在cacert文件中添加了此证书。 还生成.p12文件。 我在服务器和客户端使用相同的.p12文件。 这是服务器代码 Server server = component.getServers().add(Protocol.HTTPS, port); Series params = server.getContext().getParameters(); params.add(“keystorePath”, “.p12 file path”); params.add(“keystoreType”, “PKCS12”); params.add(“needClientAuthentication”,”true”); component.getDefaultHost().attach(“”, “/AA”), new AAClass()); component.start(); 这是客户端代码: Client client = trustAllCerts(); clientResource = new ClientResource(url); clientResource.setNext(client); try{ clientText = clientResource.post””); } catch(ResourceException e){ e.printStackTrace(); } public Client trustAllCerts() { Client client = null; try […]

带有TLSv1.2的Java 7连接到LDAPS握手失败

目前我使用的是Java 7,但我无法连接到LDAPS。 我尝试使用下面的代码,但我仍然无法连接: SSLContext ctx = SSLContext.getInstance(“TLSv1.2”); ctx.init(null, null, null); SSLContext.setDefault(ctx); 以下是我从程序中得到的错误: 2018-04-10 15:21:23,446 INFO [stdout](EJB默认值 – 1)EJB默认值 – 1,WRITE:TLSv1.2握手,长度= 221 2018-04-10 15:21:23,446 INFO [stdout](EJB默认值 – 1)EJB默认值 – 1,READ:TLSv1.2 Alert,length = 2 2018-04-10 15:21:23,446 INFO [stdout](EJB默认值 – 1)EJB默认值 – 1,RECV TLSv1 ALERT:致命,handshake_failure 2018-04-10 15:21:23,446 INFO [stdout](EJB默认值 – 1)EJB默认值 – 1,名为closeSocket() 2018-04-10 15:21:23,446 INFO [stdout](EJB默认值 – […]

Java ssl握手失败(SSLPoke)

我已将证书导入到信任库,但仍无法成功连接到此URL。 我已经尝试了所有方法,任何人都可以看到输出并帮助解决发生的事情吗? java -Djavax.net.debug=all SSLPoke services.americanexpress.com 443 keyStore is : keyStore type is : jks keyStore provider is : init keystore init keymanager of type SunX509 trustStore is: /usr/java/jdk1.8.0_60/jre/lib/security/cacerts trustStore type is : jks trustStore provider is : init truststore adding as trusted cert: …… adding as trusted cert: Subject: CN=services.americanexpress.com, OU=Web Hosting, O=American Express […]

无法通过Java代码连接到服务器。 获取javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure

我正在尝试使用可靠的框架在AWS上为REST API构建测试自动化工具。 我只是尝试使用简单的HTTP POST并检查输出JSON正文。 但是当我在Eclipse中运行它时,我得到了SSLHandshakeException 。 我确实试图调查这个问题并发现它可能与服务器证书相关( 收到致命警报:握手_failure通过SSLHandshakeException )但是当我通过POSTMAN测试它时运行正常并提供所需的输出。 此外,如果我通过浏览器点击URI确实从服务器获得响应(错误消息)。 我是SSL编程的新手,想知道它背后的根本原因是什么,以及如何解决这个问题并继续进行。 这是我的测试方法的代码段。 public class First { @Test public void myFirstRestAssuredTest() { given().header(“content-type”, “application/json”).and().header(“cache-control”, “no-cache”).expect().body(“messageType”, equalTo(“XYZ”)).when().post(https://my-server-address.com/postUpdate”); } } 这是我得到的堆栈跟踪: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:553) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:412) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:179) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:328) […]