问题描述
我要通过相互认证(TLS 1.2)通信的客户端 - 服务器应用程序(Android客户端,Apache HTTP服务器)。问题:有时连接(登录)失败,SSL错误。
I have a client-server application (Android client, Apache Http server) communicating through mutual authentication (TLS 1.2). The problem: Sometimes the connection (login) fails with an SSL error.
这工作:
- 报名的客户端证书
- 登录
这确实的不的工作:
This does not work:
- 报名的客户端证书
- 登录
- 删除客户端证书
- 报名(相同)的客户端证书
- 登录
注:第4步之后查杀应用程序,然后启动它,并执行第5步的作品
Note: Killing the app after step 4 and then start it and perform step 5 works.
可能的解释,我能想到的:
Possible explanations that I can think of:
- 一些旧的资源被重用(如旧的客户端证书)。
它看起来像一切有关(OkHttpClient等)被重新实例预期。 - SSL重新协商这也许使用新的凭证时坏?有没有一种方法来禁用它?
- Some old resources being reused (like the old client certificate).It looks like everything relevant (OkHttpClient etc) is re-instantiated as expected.
- SSL renegotiation Perhaps this is broken when using a new credential? Is there a way to disable it?
的Android(客户端)日志:
15 02-11:58:29.827 21352-23374 / com.mycompany E / com.mycompany.Connection:错误读取错误:SSL = 0x99116c00:失败的SSL库,通常一个协议错误
错误:1409441B:SSL例程:SSL3_READ_BYTES:使用TLSv1警报解密错误(外部/ OpenSSL的/ SSL / s3_pkt.c:1303 0x9928fa60:0x00000003)
错误:140940E5:SSL例程:SSL3_READ_BYTES:SSL握手失败(外部/ OpenSSL的/ SSL / s3_pkt.c:1036 0xa613bcc5:00000000)
retrofit.RetrofitError:读取错误:SSL = 0x99116c00:失败的SSL库,通常一个协议错误
错误:1409441B:SSL例程:SSL3_READ_BYTES:使用TLSv1警报解密错误(外部/ OpenSSL的/ SSL / s3_pkt.c:1303 0x9928fa60:0x00000003)
错误:140940E5:SSL例程:SSL3_READ_BYTES:SSL握手失败(外部/ OpenSSL的/ SSL / s3_pkt.c:1036 0xa613bcc5:00000000)
服务器日志:
[周四14年2月11日:58:16.736172 2016年] [SSL:错误] [PID 4424:TID 2088] [客户194.161.218.157:36836] AH02261:重新谈判握手失败
[周四14年2月11日:58:16.736172 2016年] [SSL:错误] [PID 4424:TID 2088] SSL库错误:错误:0407006A:RSA套路:RSA_padding_check_PKCS1_type_1:块类型不是01
[周四14年2月11日:58:16.736172 2016年] [SSL:错误] [PID 4424:TID 2088] SSL库错误:错误:04067072:RSA套路:RSA_EAY_PUBLIC_DECRYPT:填充检查失败
[周四14年2月11日:58:16.736172 2016年] [SSL:错误] [PID 4424:TID 2088] SSL库错误:错误:1408807B:SSL例程:ssl3_get_cert_verify:错误签名
[周四14年2月11日:59:24.655282 2016年] [SSL:错误] [PID 4424:TID 2088] [客户194.161.218.157:34530] AH02261:重新谈判握手失败
[周四14年2月11日:59:24.655282 2016年] [SSL:错误] [PID 4424:TID 2088] SSL库错误:错误:04067084:RSA套路:RSA_EAY_PUBLIC_DECRYPT:数据太大模
[周四14年2月11日:59:24.655282 2016年] [SSL:错误] [PID 4424:TID 2088] SSL库错误:错误:1408807B:SSL例程:ssl3_get_cert_verify:错误签名
我的设置:
Android版本 5.1.1
改造版本 1.9.0
OkHttp版本 2.7.2
的Apache HTTP服务器版本 2.4.17
My setup:
Android version 5.1.1
Retrofit version 1.9.0
OkHttp version 2.7.2
Apache HTTP server version 2.4.17
任何线索可能是错误或建议怎样做才能得到这条底线?
Any clues what could be wrong or suggestions what to do to get to the bottom of this?
推荐答案
我绕过通过不休息适配器上明确设置的ConnectionPool问题(因此相同,默认情况下被重复使用)。
I bypassed the issue by not setting the ConnectionPool explicitly on the rest adapter (thus the same, default, instance is re-used).
这篇关于使用客户证书和改造SSL握手失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!