HTTPS SSL实现

This commit is contained in:
egan
2017-09-23 23:05:00 +08:00
parent 089836bf2f
commit 861da0da6f
5 changed files with 206 additions and 107 deletions

View File

@@ -40,6 +40,13 @@ public class ApyAccount {
// 收款账号
// @Column(name = "seller")
private String seller;
//请求证书地址,请使用绝对路径
private String keystorePath;
//证书对应的密码
private String storePassword;
// 签名类型
// @Column(name = "sign_type")
private String signType;
@@ -156,6 +163,22 @@ public class ApyAccount {
return isTest;
}
public String getKeystorePath() {
return keystorePath;
}
public void setKeystorePath(String keystorePath) {
this.keystorePath = keystorePath;
}
public String getStorePassword() {
return storePassword;
}
public void setStorePassword(String storePassword) {
this.storePassword = storePassword;
}
public void setTest(boolean test) {
isTest = test;
}

View File

@@ -57,12 +57,14 @@ public class PayResponse {
}
/**
* 获取http配置如果配置为null则为默认配置无代理。
* 此处非必需
* @return
* 获取http配置如果配置为null则为默认配置无代理,无证书的请求方式
* 此处非必需
* @param apyAccount 账户信息
* @return 请求配置
*/
public HttpConfigStorage getHttpConfigStorage(){
public HttpConfigStorage getHttpConfigStorage(ApyAccount apyAccount){
HttpConfigStorage httpConfigStorage = new HttpConfigStorage();
/*
//http代理地址
httpConfigStorage.setHttpProxyHost("192.168.1.69");
//代理端口
@@ -71,6 +73,10 @@ public class PayResponse {
httpConfigStorage.setHttpProxyUsername("user");
//代理密码
httpConfigStorage.setHttpProxyPassword("password");
*/
httpConfigStorage.setKeystorePath(apyAccount.getKeystorePath());
httpConfigStorage.setStorePassword(apyAccount.getStorePassword());
return httpConfigStorage;
}