Browse Source

证件号码解密问题

li.shaoyi 3 years ago
parent
commit
1bccb6f226
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/utils/websocket/crypto/index.ts

+ 4 - 4
src/utils/websocket/crypto/index.ts

@@ -132,7 +132,7 @@ export const encrypt50 = (plainText: Uint8Array): Uint8Array | null => {
     data1.set(macData, 4 + a2.length);
 
     return data1;
-};
+}
 
 /**
  * 5.0报文数据解密方法
@@ -151,7 +151,7 @@ export const decrypt50 = (encryptData: Uint8Array, size: number): Uint8Array | n
     }
 
     return a.subarray(0, size);
-};
+}
 
 /**
  * AES数据解密方法
@@ -167,8 +167,8 @@ export const decryptAES = (value: string): string | undefined => {
     });
 
     const decrytped = CryptoJS.AES.decrypt(cipherParams, uint8ArrayToWordArray(key), aesOption);
-    const h = wordArrayToUint8Array(decrytped).subarray(0, decrytped.words.length * 4 - 1);
+    const h = wordArrayToUint8Array(decrytped).subarray(0, decrytped.sigBytes);
     const result = new TextDecoder().decode(h);
     return result;
-};
+}