当前位置:网站首页>微众对接机制备忘
微众对接机制备忘
2022-07-17 05:02:00 【dzl84394】
对接秘钥备忘
走了太多弯路,没有一个攻略,实在是太难了
- 对接平台提供
server.csr
server.key - 微众返回
trustca.jks
WeBank_DEV_CA.crt
haha.crt
haha.csr
haha.jks
haha.key
haha.p12
根据命令行可得
haha.crt + server.key => haha.p12
haha.p12 => haha.jks
- 微众给的crt,和我自己的key文件,生成p12文件
openssl pkcs12 -export -in haha.crt -inkey server.key -out haha.p12 -name haha -CAfile myCA.crt
输入密码是a123456(各自定义),要重复一次,还会报错,但是不要紧,p12文件出来就行
name 别名和cafile都无关紧要
报错信息,其实不要紧
Enter Export Password:
Verifying - Enter Export Password:
Verify failure
Can't read Password
- p12 生成jks
keytool -importkeystore -srckeystore haha.p12 -srcstoretype PKCS12 -srcstorepass a123456 -deststoretype JKS -destkeystore haha.jks -deststorepass b123456
这样密码就是a123456,b123456,也可以设一样的,各自随意
题外话: jks可以和p12互转。
jks可以转成cer文件(有的网站直接可以导出cer),cer再导入jre,理论上不需要代码里面再提现这方面内容,当然这里没有验证过
- 或者直接用微众返回的 haha.jks
默认密码 Abcd1234(测试环境已证实)
代码示例
public CloseableHttpClient initHttpClient() {
CloseableHttpClient httpClient = null;
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
//加载证书文件
FileInputStream instream = new FileInputStream(new File(webankConf.getCertPath()));//jks导入
try {
//这里是storepass b123456
keyStore.load(instream, "Abcd1234".toCharArray());
} finally {
instream.close();
}
// 这里是源密码,a123456
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "Abcd1234".toCharArray()).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext,
SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
httpClient = HttpClients.custom()
.setSSLSocketFactory(sslsf)
.build();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (CertificateException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (UnrecoverableKeyException e) {
e.printStackTrace();
}
return httpClient;
}
边栏推荐
猜你喜欢

Tidb performance analysis and optimization
![Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout](/img/8b/29027c2dee4ef764bb2e4b5b499a23.jpg)
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout

邮箱发送邮件(包含附件,网易、QQ)

赚钱大师小程序【最新版5.9.9】商城/佣金即时提现/分销推广/话费充值/美团饿了么外卖

‘ionic‘ 不是内部或外部命令,也不是可运行的程序或批处理文件。

OLTP 负载性能优化实践

Unity UMP打包黑屏問題總結
![[Unity] Input. Index of gettouch[index]](/img/9d/ec0e4c9e6b1bb25976357469fe037f.png)
[Unity] Input. Index of gettouch[index]

渗透测试 10 --- 扫描 web目录 (dirb、wfuzz、wpscan、nikto)

PowerDesigner displays comment comments
随机推荐
Tidb performance analysis and optimization
Blessing for the elderly popular short video wechat applet source code download support traffic master
Base64与文件互转
PY3 redis general call
Mysql8.026-- view (bottom)
复旦微FMQL(国产Zynq) 【IAR裸机开发之PS】——非字节对齐访问
[FPGA tutorial case 26] realize the basic operation of decimals through Verilog in FPGA
Fudan micro fmql (domestic zynq) [PS of IAR bare metal development] - non byte aligned access
Website online package APK system source code
高等数学笔记:关于等价无穷小替换的一个猜想
[TA frost wolf \u may - hundred people plan] Figure 2.5 bump mapping
[fuel cell] simulation of fuel cell system control strategy based on Simulink
MySQL必知必会!!!看这一篇就足够了!!!
Wildfly: how to call EJBs from EJBs located in another application
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout
Project structure of wechat applet
Construction and application of knowledge map de (VII): large scale knowledge map pre training
Notes on Advanced Mathematics: second derivative of composite function and curvature of solving parametric equation
TiDB 性能分析和优化
Multiple connections will be maintained for each provider instance