Browse Source

更新图谱内容加密功能

MarkHuang 6 years ago
parent
commit
d0d7912237
1 changed files with 3 additions and 1 deletions
  1. 3 1
      graph/src/main/java/org/diagbot/graph/encryption/DESUtil.java

+ 3 - 1
graph/src/main/java/org/diagbot/graph/encryption/DESUtil.java

@@ -102,7 +102,7 @@ public class DESUtil {
         // 执行加密操作。加密后的结果通常都会用Base64编码进行传输
 //        return Base64.encodeBase64String(results);
 
-        return getHash(results);
+        return padding + getHash(results);
     }
 
     /**
@@ -112,6 +112,8 @@ public class DESUtil {
      * @return 解密后的数据
      */
     public static String decrypt(String data, String key) throws Exception {
+        data = data.substring(padding.length());
+
         Key deskey = keyGenerator(key);
         Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
         //初始化Cipher对象,设置为解密模式