Android HTTPS SSL 重用和缓存
我知道这个问题已经被问过好几次了。我已经尝试了所有这些,但没有一个能按我想要的方式工作。 我以 30 秒的间隔重复轮询 Web 服务。 Web 服务基于 HTTPS / SSL。我想消除每个 Web 服务调用上的 SSL 握手的开销(SSL 重用)。我怎样才能实现这个目标?
我查看了 SSLCertificateSocketFactory
和 SSLSessionCache
这似乎是答案。 来获取 SSLSocket
实例
SSLSocketFactory sockFactory = SSLCertificateSocketFactory.getHttpSocketFactory(TIMEOUT, sslSession);
我可以通过调用但是我找不到将我的密钥库和密码设置到此套接字工厂的方法 。我想您只能通过 SSLSocketFactory 构造函数设置密钥库和密码。
所以我的两个问题是 1)需要SSL复用 2)需要使用我的密钥库来接受来自服务器的证书。
谢谢
I know this has been asked several times. I've tried them all but none of them work as I want.
I'm polling a webservice repeatedly in 30 second intervals. The webservice is based on HTTPS / SSL. I want to remove the overhead of SSL handshake on each webservice call ( SSL reuse). How can I achieve this?
I've looked at SSLCertificateSocketFactory
and SSLSessionCache
which seems to be the answer. I can get an SSLSocket
instance by calling
SSLSocketFactory sockFactory = SSLCertificateSocketFactory.getHttpSocketFactory(TIMEOUT, sslSession);
However I cannot find a way to set my keystore and password to this socket factory. I guess you can set the keystore and password only via an SSLSocketFactory
constructor.
So my 2 problems are
1) Need SSL reuse
2) Need to use my keystore for accepting the certificates from the server.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论