Skip to content

Commit

Permalink
Merge pull request #53 from changhr2013/master
Browse files Browse the repository at this point in the history
[mod]增强 AES 加解密算法的工具类
  • Loading branch information
yinjihuan authored Apr 24, 2020
2 parents 73eabd6 + 39b6d2d commit 873ce6a
Show file tree
Hide file tree
Showing 11 changed files with 497 additions and 297 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ target/
# system ignore
.DS_Store
Thumbs.db
/monkey-api-encrypt-core/src/main/resources/rebel.xml
/monkey-api-encrypt-springboot-example/src/main/resources/rebel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface EncryptAlgorithm {
* @return 加密内容
* @throws Exception 加密失败
*/
public String encrypt(String content, String encryptKey) throws Exception;
String encrypt(String content, String encryptKey) throws Exception;

/**
* 解密
Expand All @@ -18,6 +18,6 @@ public interface EncryptAlgorithm {
* @return 解密内容
* @throws Exception 解密失败
*/
public String decrypt(String encryptStr, String decryptKey) throws Exception;
String decrypt(String encryptStr, String decryptKey) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class EncryptionConfig {
* 比如:/user/list<br>
* 不支持@PathVariable格式的URI
*/
private List<String> requestDecyptUriList = new ArrayList<String>();
private List<String> requestDecryptUriList = new ArrayList<String>();

/**
* 忽略加密的接口URI<br>
Expand All @@ -48,7 +48,7 @@ public class EncryptionConfig {
* 比如:/user/list<br>
* 不支持@PathVariable格式的URI
*/
private List<String> requestDecyptUriIgnoreList = new ArrayList<String>();
private List<String> requestDecryptUriIgnoreList = new ArrayList<String>();

/**
* 响应数据编码
Expand All @@ -74,12 +74,12 @@ public EncryptionConfig() {
super();
}

public EncryptionConfig(String key, List<String> responseEncryptUriList, List<String> requestDecyptUriList,
public EncryptionConfig(String key, List<String> responseEncryptUriList, List<String> requestDecryptUriList,
String responseCharset, boolean debug) {
super();
this.key = key;
this.responseEncryptUriList = responseEncryptUriList;
this.requestDecyptUriList = requestDecyptUriList;
this.requestDecryptUriList = requestDecryptUriList;
this.responseCharset = responseCharset;
this.debug = debug;
}
Expand All @@ -104,16 +104,16 @@ public void setResponseEncryptUriList(List<String> responseEncryptUriList) {
this.responseEncryptUriList = responseEncryptUriList;
}

public List<String> getRequestDecyptUriList() {
public List<String> getRequestDecryptUriList() {
// 配置了注解则用注解获取的URI
if (ApiEncryptDataInit.requestDecyptUriList.size() > 0) {
return ApiEncryptDataInit.requestDecyptUriList;
if (ApiEncryptDataInit.requestDecryptUriList.size() > 0) {
return ApiEncryptDataInit.requestDecryptUriList;
}
return requestDecyptUriList;
return requestDecryptUriList;
}

public void setRequestDecyptUriList(List<String> requestDecyptUriList) {
this.requestDecyptUriList = requestDecyptUriList;
public void setRequestDecryptUriList(List<String> requestDecryptUriList) {
this.requestDecryptUriList = requestDecryptUriList;
}

public String getResponseCharset() {
Expand Down Expand Up @@ -160,20 +160,20 @@ public void setResponseEncryptUriIgnoreList(List<String> responseEncryptUriIgnor
this.responseEncryptUriIgnoreList = responseEncryptUriIgnoreList;
}

public List<String> getRequestDecyptUriIgnoreList() {
public List<String> getRequestDecryptUriIgnoreList() {
// 配置了注解则用注解获取的URI
if (ApiEncryptDataInit.requestDecyptUriIgnoreList.size() > 0) {
return ApiEncryptDataInit.requestDecyptUriIgnoreList;
if (ApiEncryptDataInit.requestDecryptUriIgnoreList.size() > 0) {
return ApiEncryptDataInit.requestDecryptUriIgnoreList;
}
return requestDecyptUriIgnoreList;
return requestDecryptUriIgnoreList;
}

public void setRequestDecyptUriIgnoreList(List<String> requestDecyptUriIgnoreList) {
this.requestDecyptUriIgnoreList = requestDecyptUriIgnoreList;
public void setRequestDecryptUriIgnoreList(List<String> requestDecyptUriIgnoreList) {
this.requestDecryptUriIgnoreList = requestDecyptUriIgnoreList;
}

public List<String> getRequestDecyptParams(String uri) {
List<String> params = ApiEncryptDataInit.requestDecyptParamMap.get(uri);
public List<String> getRequestDecryptParams(String uri) {
List<String> params = ApiEncryptDataInit.requestDecryptParamMap.get(uri);
if (CollectionUtils.isEmpty(params)) {
return new ArrayList<>();
}
Expand Down
Loading

0 comments on commit 873ce6a

Please sign in to comment.