添加心跳包检测
This commit is contained in:
1 parent
127f58bd36
commit
ec5fcf1ee7
5 files changed
+149
-67
No files matched your search
+12
-4
@@ -61,12 +61,16 @@ const SM4 = (key,data)=>{
|
||||
return new Uint8Array(encryptedBytes);
|
||||
}
|
||||
const encrypt = (key, data, fileName, setting, message) => {
|
||||
// if(!encryptFunction){
|
||||
// encryptFunction = setting.activeFuction
|
||||
// }
|
||||
let encryptFunction = {0:'不加密',16:'AES128',19:'SM4',32:'AES256'}[key.length]
|
||||
return blob2Uint8Array(data).then(data => {
|
||||
let encrypted_data = null
|
||||
if(setting.activeFuction === "不加密"){
|
||||
if(encryptFunction === "不加密"|| key === ''){
|
||||
encrypted_data = data
|
||||
// AES
|
||||
}else if(setting.activeFuction != "SM4"){
|
||||
}else if(encryptFunction != "SM4"){
|
||||
message.info(`开始加密${fileName}`);
|
||||
encrypted_data = AES(key,data)
|
||||
message.info(`${fileName}加密完成`);
|
||||
@@ -83,11 +87,15 @@ const encrypt = (key, data, fileName, setting, message) => {
|
||||
|
||||
// setting为pinia存储的setting。。。
|
||||
const encryptString = (key, str, setting) => {
|
||||
// if(!encryptFunction){
|
||||
// encryptFunction = setting.activeFuction
|
||||
// }
|
||||
// console.log(key,key.length)
|
||||
if(setting.activeFuction === "不加密" || key === ''){
|
||||
let encryptFunction = {0:'不加密',16:'AES128',19:'SM4',32:'AES256'}[key.length]
|
||||
if(encryptFunction === "不加密" || key === ''){
|
||||
// return sm4.encrypt(str, 'miaospringmiaospringmiaospringao')
|
||||
return Base64.encode(str)
|
||||
}else if(setting.activeFuction !== "SM4"){
|
||||
}else if(encryptFunction !== "SM4"){
|
||||
key = aesjs.utils.utf8.toBytes(key);
|
||||
var data = aesjs.utils.utf8.toBytes(str);
|
||||
var aesCtr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter(5));
|
||||
|
||||
Reference in new issue
Block a user