Android的SSL握手异常的地图API
问题描述:
try {
String urlImage="https://maps.googleapis.com/maps/api/staticmap?center=0,0&zoom=1&size=100x100&key=AIzaSyD_G0t3zg97XK1iiZD2kV5J_mBTlnV6_ZI";
System.out.println(urlImage);
bitmap1 = BitmapFactory.decodeStream((InputStream) new URL(urlImage).getContent());
} catch (Exception e) {
e.printStackTrace();
}
当我把这个网址我得到Android的SSL握手异常的地图API
javax.net.ssl.sslhandshakeexception:Handshake failed
例外,我怎么能解决这个问题
答
从这个related SO post基础,你需要获得来自公证书你正试图连接的服务器。 尝试联系服务器管理员并询问它,using openssl to download it,或者因为这看起来像是HTTP服务器,请使用任何浏览器连接到它,查看页面的安全信息并保存证书的副本。在本documentation还表示,发生这种情况的原因很多,其中包括:
- The CA that issued the server certificate was unknown
- The server certificate wasn't signed by a CA, but was self signed
- The server configuration is missing an intermediate CA
您可以检查哪些讨论的文件如何解决这些问题同时保持与服务器的连接安全。