【发布时间】:2011-09-07 20:20:12
【问题描述】:
我正在尝试使用自签名客户端和服务器证书通过 Android 的 HttpClient 连接到 HTTPS 网络服务器。证书和私钥都存储在 PKCS#12 密钥库中。
我使用 this example 与加载密钥库的区别:
KeyStore trustStore = KeyStore.getInstance("PKCS12");
trustStore.load(new FileInputStream(keystoreFile), "mypass".toCharArray());
密钥库正确加载,因为我能够列出其中的所有证书。
但是,当执行 GET 请求时,我得到:
09-07 22:01:05.197: ERROR/TTT(3716): IOException: java.io.IOException:
SSL handshake failure: Failure in SSL library, usually a protocol error
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
(external/openssl/ssl/s3_pkt.c:1127 0x2e3b40:0x00000003)
我正在使用 OS 2.3.4 的 Nexus S 和使用 OS 2.2 的 HTC Desire 以及使用 OS 2.1 的模拟器上对此进行测试。它们都产生相同的错误。我查看了s3_pkt.c:1053,但无法理解问题所在。
有什么想法吗?
【问题讨论】:
标签: android ssl https certificate