赞
踩
前:最近做基于XMPP协议的IM,服务端用的是OpenFire,客户端用的Smack包,需要进行TLS加密服务端设置为只支持TLS1.2,可是我开加密的时候客户端总是TLS1,不知为何,最终在stackoverflow找到答案:http://stackoverflow.com/questions/37815995/android-smack-ssl-tls-connection-to-xmpp-ejabberd-server-with-ca-certificate
我的代码:
- MySSLSocketFactory mySSLSocketFactory=null;
- try {
- KeyStore trustStore = KeyStore.getInstance("BKS");
- mySSLSocketFactory = new MySSLSocketFactory(trustStore,服务器HOST);
- } catch (KeyStoreException e) {
- e.printStackTrace();
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- } catch (UnrecoverableKeyException e) {
- e.printStackTrace
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。