相关疑难解决方法(0)

使用HttpClient通过HTTPS信任所有证书

最近发布了一个关于HttpClient过度Https 的问题(在这里找到).我已经取得了一些进展,但我遇到了新的问题.和我的上一个问题一样,我似乎无法找到适合我的任何地方的例子.基本上,我希望我的客户端接受任何证书(因为我只指向一个服务器),但我一直在接受javax.net.ssl.SSLException: Not trusted server certificate exception.

所以这就是我所拥有的:


    public void connect() throws A_WHOLE_BUNCH_OF_EXCEPTIONS {

        HttpPost post = new HttpPost(new URI(PROD_URL));
        post.setEntity(new StringEntity(BODY));

        KeyStore trusted = KeyStore.getInstance("BKS");
        trusted.load(null, "".toCharArray());
        SSLSocketFactory sslf = new SSLSocketFactory(trusted);
        sslf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme ("https", sslf, 443));
        SingleClientConnManager cm = new SingleClientConnManager(post.getParams(),
                schemeRegistry);

        HttpClient client = new DefaultHttpClient(cm, post.getParams());
        HttpResponse result = client.execute(post);
    }
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

    W/System.err(  901): javax.net.ssl.SSLException: Not trusted server certificate 
    W/System.err(  901):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:360) 
    W/System.err(  901): …
Run Code Online (Sandbox Code Playgroud)

java ssl https certificate apache-httpclient-4.x

386
推荐指数
9
解决办法
57万
查看次数

React Native fetch()网络请求失败

当我使用react-native init(RN版本0.29.1)创建一个全新的项目并将渲染方法中的提取放到公共Facebook演示电影API时,它会抛出一个Network Request Failed.有一个非常无用的堆栈跟踪,我无法在chrome控制台中调试网络请求.这是我发送的提取:

fetch('http://facebook.github.io/react-native/movies.json')
      .then((response) => response.json())
      .then((responseJson) => {
        return responseJson.movies;
      })
      .catch((error) => {
        console.error(error);
      });
Run Code Online (Sandbox Code Playgroud)

javascript react-native fetch-api

123
推荐指数
14
解决办法
15万
查看次数

如何告诉Android Volley中的TLS版本

我的项目已经使用Android Volley网络框架很长一段时间了,但最近我发现了Internet上发布的SSL 3.0协议错误.

我想知道如何找出我的项目使用的TLS版本,以及如何确认库是否更新.

这是我的源代码片段:

HttpStack stack = new HurlStack();
Network network = new BasicNetwork(stack);
mHttpRequestQueue = new RequestQueue(new NoCache(), network);
mHttpRequestQueue.start();
Run Code Online (Sandbox Code Playgroud)

我认为重点在于HurlStack类,它取决于org.apache.http包,但我无法弄清楚TLS/SSL配置的位置.

ssl https android android-volley sslsocketfactory

8
推荐指数
1
解决办法
7496
查看次数

com.android.volley.NoConnectionError:javax.net.ssl.SSLHandshakeException:javax.net.ssl.SSLProtocolException:SSL握手已中止:

我在我的应用程序中使用Android中的Volley库,当我尝试向我们的服务器发出POST请求时,我收到以下错误:

com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6821edb0: Failure in SSL library, usually a protocol error
error:1407743E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert inappropriate fallback (external/openssl/ssl/s23_clnt.c:744 0x5f4c0c46:0x00000000)
Run Code Online (Sandbox Code Playgroud)

我们的服务器使用以下SSL证书进行签名:

i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Organization Validation Secure Server CA
1 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Organization Validation Secure Server CA
i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
 2 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
Run Code Online (Sandbox Code Playgroud)

该证书由openssl描述如下:

New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Run Code Online (Sandbox Code Playgroud)

我检查了Cipher over Android启用的密码,他们说它默认启用.

我已经针对这个问题尝试了以下解决方案,但没有一个解决了它:

对Volley Android网络库的HTTPS支持 …

ssl android android-volley

8
推荐指数
1
解决办法
1万
查看次数

通过HTTPS连接到安装了Windows 2003 Server SP2的SHA256 CA时,Android 7.0 Nougat中出现"由peer关闭连接"错误

我的应用程序通过HTTPS与服务器界面(经典ASP)进行通信.
它在Android 7.0 Nougat的早期版本中运行得非常好.(直到6.0)
但是,在Android 7.0手机和AVD(Android虚拟设备)中出现由对等关闭连接错误.
服务器是Windows 2003 Server SP2(2016年7月23日SSL证书从SHA1更新到SHA256),HTTPS,经典ASP
服务器的GeoTrust的SSL证书安装检查状态如下
(cryptoreport.geotrust.com/checker/views/certCheck. jsp)
GeoTrust检查我的服务器证书的状态屏幕截图
(未启用协议:TLS1.1,TLS1.2)

在我看来,Android 7.0无法与TLS1.0的Windows 2003 Server进行SSL握手(只有TLSv1.1,TLSv1.2可以支持使用SHA256证书成功握手吗?)
这是对的吗?
我刚刚发现这个热门修复程序:http://support.microsoft.com/kb/968730
这可以是一个解决方案吗?

我怎么能解决这个问题

https android sha256 sslhandshakeexception android-7.0-nougat

5
推荐指数
1
解决办法
2475
查看次数

通用图像加载器| SSLHandshakeException:握手失败

我有一个ListView与项目中的一些内容(TextViews,ImageView ...).我正在使用Nostra的UIL加载项目中的图像,但其中一些无法加载.当我打电话时,这就是我得到的Log.v(String.valueOf(failReason.getCause());:

11-16 23:52:20.447: V/javax.net.ssl.SSLHandshakeException: Handshake failed(17467): failz
11-16 23:52:20.657: V/NativeCrypto(17467): SSL handshake aborted: ssl=0x15fd758: Failure in SSL library, usually a protocol error
11-16 23:52:20.657: V/NativeCrypto(17467): error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:762 0x4c2ed485:0x00000000)
11-16 23:52:21.207: V/NativeCrypto(17467): SSL handshake aborted: ssl=0x1562468: Failure in SSL library, usually a protocol error
11-16 23:52:21.207: V/NativeCrypto(17467): error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:762 0x4c2ed485:0x00000000)
Run Code Online (Sandbox Code Playgroud)

你不知道,为什么会出现这个问题或者我该如何解决?

这是一个示例图像,无法加载:

http://bigparty.cz/photos/headlinefoto/13.jpg

(我可以附加一个包含整个错误的日志 - UIL 自动将其放入Log的错误)

android image-loading imageview sslhandshakeexception universal-image-loader

3
推荐指数
1
解决办法
3878
查看次数

握手失败使用 okHttp 但使用 HttpURLConnection

我正在尝试向服务器发送 get 请求(发送 get 请求进行测试,实际上我需要向同一台服务器发送一个 post 请求。如果 get 有效,post 将起作用)

服务器链接是 https://bits-bosm.org/2017/registrations/signup/

问题是当我使用 okHttp 发送请求时,我收到一个失败响应,说握手失败。

这是我用来使用 okHttp 发送请求的代码(在 kotlin 中)

val request = Request.Builder()
            .url("https://bits-bosm.org/2017/registrations/signup/")
            .build()

    okHttpClient.newCall(request).enqueue(object : Callback {
        override fun onFailure(call: Call?, e: IOException?) {
            val mMessage = e?.message?.toString()
            Log.w("failure Response", mMessage)
        }

        override fun onResponse(call: Call?, response: Response?) {
            val mMessage = response?.body()?.string()
            Log.e("Message", mMessage)
        }
    })
Run Code Online (Sandbox Code Playgroud)

但是如果我使用 HttpUrlConnection 将获取请求发送到同一台服务器,我会得到响应。

这是相同的代码(java)

private static final String USER_AGENT = "Mozilla/5.0";

private static final String GET_URL = "https://bits-bosm.org/2017/registrations/signup/";



static void …
Run Code Online (Sandbox Code Playgroud)

ssl android httpurlconnection okhttp

1
推荐指数
1
解决办法
2350
查看次数