private HttpsURLConnection httpsConfig() throws Exception{
CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream in = activity.getAssets().open("new-jzbank.cer");//new-jzbank.cer为证书文件
Certificate cartificate = cf.generateCertificate(in);
in.close();
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
keystore.load(null, null);
keystore.setCertificateEntry("trust", cartificate);
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(keystore);
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, trustManagerFactory.getTrustManagers(), null);
HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
urlConnection.setSSLSocketFactory(context.getSocketFactory());
return urlConnection;
}