From 2335f1f34b779774afdd216ad74679f29e152b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=AF=BA?= <1253070437@qq.com> Date: Wed, 19 Apr 2023 21:40:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=89=8D=E7=AB=AF=E5=8A=A0=E5=AF=86=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=E4=B8=AD=E7=9A=84=E7=A7=81=E9=92=A5=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=97=A0=E7=94=A8=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snowy-admin-web/src/utils/smCrypto.js | 32 --------------------------- 1 file changed, 32 deletions(-) diff --git a/snowy-admin-web/src/utils/smCrypto.js b/snowy-admin-web/src/utils/smCrypto.js index 882f8d09..7f7bab0c 100644 --- a/snowy-admin-web/src/utils/smCrypto.js +++ b/snowy-admin-web/src/utils/smCrypto.js @@ -17,13 +17,9 @@ import smCrypto from 'sm-crypto' const sm2 = smCrypto.sm2 -const sm3 = smCrypto.sm3 -const sm4 = smCrypto.sm4 const cipherMode = 1 // 1 - C1C3C2,0 - C1C2C3,默认为1 const publicKey = '04298364ec840088475eae92a591e01284d1abefcda348b47eb324bb521bb03b0b2a5bc393f6b71dabb8f15c99a0050818b56b23f31743b93df9cf8948f15ddb54' -const privateKey = '3037723d47292171677ec8bd7dc9af696c7472bc5f251b2cec07e65fdef22e25' -const key = '0123456789abcdeffedcba9876543210' /** * 国密加解密工具类 @@ -33,36 +29,8 @@ export default { doSm2Encrypt(msgString) { return sm2.doEncrypt(msgString, publicKey, cipherMode) }, - // SM2解密 - doSm2Decrypt(encryptData) { - return sm2.doDecrypt(encryptData, privateKey, cipherMode) - }, // SM2数组加密 doSm2ArrayEncrypt(msgString) { return sm2.doEncrypt(msgString, publicKey, cipherMode) - }, - // SM2数组解密 - doSm2ArrayDecrypt(encryptData) { - return sm2.doDecrypt(encryptData, privateKey, cipherMode, { output: 'array' }) - }, - // SM3哈希 - doSm3Hash(msgString) { - return sm3(msgString) - }, - // SM4 加密 - doSm4Encrypt(msgString) { - return sm4.encrypt(msgString, key) - }, - // SM4 CBC加密 - doSm4CbcEncrypt(msgString) { - return sm4.encrypt(msgString, key, { mode: 'cbc', iv: 'fedcba98765432100123456789abcdef' }) - }, - // SM4 解密 - doSm4Decrypt(encryptData) { - return sm4.decrypt(encryptData, key) - }, - // SM4 CBC解密 - doSm4CbcDecrypt(encryptData) { - return sm4.decrypt(encryptData, key, { mode: 'cbc', iv: 'fedcba98765432100123456789abcdef' }) } }