项目中遇到了联网请求的的证书验证,其中一个错误是比较容易忽略的问题
一、
HTTPS连接类存在严重安全漏洞:
未按照最佳代码安全实践去处理HTTPS加密连接的域名和证书匹配性检查
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
改为:
sf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); //这样一个CA验证的连接才会被保护
二、SSL认证,在Android中的发挥
The Secure Sockets Layer (SSL)—now technically known asTransport Layer Security (TLS)—is a common building block for encrypted communications between clients and servers. It's possible that an application might use SSL incorrectly such that malicious entities may be able to intercept an app's data over the network. To help you ensure that this does not happen to your app, this article highlights the common pitfalls when using secure network protocols and addresses some larger concerns about using Public-Key Infrastructure (PKI).
安全套接字层(SSL)现在技术上被称为传输层安全(TLS) ,是一种常见的积木为客户端和服务器之间的加密通信。这有可能是一个应用程序可能使用SSL错误,使得恶意实体可能能够在网络上拦截一个应用程序的数据。为了帮助您确保这种情况不会发生在你的应用程序,本文使用安全网络协议和地址使用一些较大的担忧凸显时常见的陷阱公钥基础设施(PKI)