日期:2014-05-18 浏览次数:20512 次
/**设置https环境 * java环境下设置SSL环境 * 路径参数需要根据实际情况修改 */ public static void setSSLProperty() { Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); System.setProperty("javax.net.ssl.keyStore", "D:/testkeys/test.pfx"); System .setProperty("javax.net.ssl.trustStore", "D:/testkeys/truststore"); System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); System.setProperty("javax.net.ssl.keyStorePassword", "123456"); System.setProperty("javax.net.ssl.keyStoreType", "pkcs12"); System.setProperty("javax.net.ssl.trustStoreType", "jks"); }
com.ecitic.bank.pay.PaymentServicesService ZXPayment = new ZhongXin.com.ecitic.bank.pay.PaymentServicesService(); ZXPayment.ClientCertificates.Add(new X509Certificate2("intcmd\\jfk_zx_ca_new.pfx", "!QAZ@WSX")); CookieContainer cc = new CookieContainer(); ZXPayment.CookieContainer = cc;