getResourceAsStream

SPDB_Express_Key_Path=/key/SPDB/spdb.pfx  去掉conf前面的路径

private synchronized static void initSSLContext() {
if (sslCtx == null) {
String keyPath = BankMessageUtil.SPDB_Express_Key_Path;
String password = BankMessageUtil.SPDB_Express_Key_Password;
try {
sslCtx = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());// "SunX509"
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(Resources.getResourceAsStream(keyPath), password.toCharArray());
kmf.init(ks, password.toCharArray());
sslCtx.init(kmf.getKeyManagers(), trustAllCerts, null);
log.info("load keystore success.");
} catch (Exception ex) {
log.error(ex);
}
}
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326647569&siteId=291194637