登录提交信息加密,新增Base64的支持

This commit is contained in:
thinkgem
2020-03-12 22:06:57 +08:00
parent aeb98bec83
commit effa1ef257
5 changed files with 61 additions and 47 deletions

View File

@@ -25,6 +25,9 @@ public class DesUtils {
if (StringUtils.isBlank(data)){
return "";
}
if ("Base64".equals(secretKey)) {
return EncodeUtils.encodeBase64(data);
}
String[] ks = StringUtils.split(secretKey, ",");
if (ks.length >= 3){
return desCore.strEnc(data, ks[0], ks[1], ks[2]);
@@ -39,6 +42,9 @@ public class DesUtils {
if (StringUtils.isBlank(data)){
return "";
}
if ("Base64".equals(secretKey)) {
return EncodeUtils.decodeBase64String(data);
}
String[] ks = StringUtils.split(secretKey, ",");
if (ks.length >= 3){
return desCore.strDec(data, ks[0], ks[1], ks[2]);

View File

@@ -18,6 +18,9 @@
*/
this.DesUtils.encode = function(data, secretKey){
if (data && secretKey){
if (secretKey === 'Base64'){
return Base64.encode(data);
}
var ks = secretKey.split(',');
if (ks.length >= 3){
return strEnc(data, ks[0], ks[1], ks[2]);
@@ -32,6 +35,9 @@
*/
this.DesUtils.decode = function(data, secretKey){
if (data && secretKey){
if (secretKey === 'Base64'){
return Base64.decode(data);
}
var ks = secretKey.split(',');
if (ks.length >= 3){
return strDec(data, ks[0], ks[1], ks[2]);