javax.net.ssl.SSLHandshakeException:收到致命警报:access_denied

时间:2018-08-15 09:38:35

标签: java linux ssl https sslhandshakeexception

我有以下程序(从网上下载并编辑),当我运行时,该程序给我一个错误“ javax.net.ssl.SSLHandshakeException:收到致命警报:access_denied ”。在整个SO和其他地方,我看到了许多针对“ handshake_failure”的解决方案,而没有针对“ access_denied”的解决方案。操作系统是RHEL 7.4

我的原始问题不是连接到google.com时,而是连接到第三方服务时。具有此代码的程序从代理后面运行。运行程序时,我已将代理服务器和端口指定为参数。无论端点URL如何,我都会收到上述错误。因此,似乎是本地计算机上的某些设置。关于设置可能有什么问题的任何建议?我读过的文章提到CLientHello从客户端中消失,服务器以ServerHello作为响应。我尝试使用 -Djavax.net.debug = all 运行程序,并看到ClientHello熄灭但没有收到ServerHello。

Java版本详细信息

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

我尝试使用$ JAVA_HOME的jre / lib / security目录中的受限jar和无限jar。虽然可能没有必要,但我已经明确尝试将cacerts文件的位置指定为信任库。

代码在下面

import org.apache.http.*;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class TestHttps {

  public static void main(String[] args) {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    try {
      HttpHost target = new HttpHost("www.google.com", 443, "https");

      HttpGet getRequest = new HttpGet("/");
      System.out.println("executing request to " + target);

      HttpResponse httpResponse = httpclient.execute(target, getRequest);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

0 个答案:

没有答案