封装海阔的rsa函数调用

This commit is contained in:
hjdhnx 2023-10-04 21:04:28 +08:00
parent e6e90c01c6
commit 40fc2bd525
6 changed files with 82 additions and 8 deletions

View File

@ -1,10 +1,21 @@
###### 2023/10/04
- 关于rsa加解密的研究js模块导入方式研究失败。请用蜜蜂壳子注入的函数实现
- [X] 关于rsa加解密的研究js模块导入方式研究失败。请用蜜蜂壳子注入的函数实现
```js
log(typeof(rsaX));
if(typeof(rsaX)=='function'){
rsaX(mode, pub, encrypt, input, inBase64, key, outBase64)
}
```
- [X] 3.9.48beta8内部封装了RSA相关加解密函数。用法为
```js
let data = base64Encode('你好');
let publicKey = 'dzyyds';
console.log(typeof (RSA.encode));
let encryptBase64Data = RSA.encode(data,publicKey);
log('encryptBase64Data:'+encryptBase64Data);
let str = RSA.decode(data,publicKey);
log('str:'+str);
```
###### 2023/10/03

View File

@ -1 +1 @@
3.9.48beta7
3.9.48beta8

View File

@ -55,7 +55,7 @@ function pre(){
}
let rule = {};
const VERSION = 'drpy1 3.9.48beta4 20231004';
const VERSION = 'drpy1 3.9.48beta8 20231004';
/**
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼最新的文件发现这问题已经解决了]
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
@ -434,6 +434,34 @@ function getCryptoJS(){
return 'console.log("CryptoJS已装载");'
}
// 封装的RSA加解密类
const RSA = {
encode:function (data,key,option){
// log('encode');
if(typeof(rsaEncrypt)==='function'){
if(!option||typeof(option)!=='object'){
return rsaEncrypt(data,key);
}else{
return rsaEncrypt(data,key,option);
}
}else{
return false
}
},
decode:function (data,key,option){
// log('decode');
if(typeof(rsaDecrypt)==='function'){
if(!option||typeof(option)!=='object'){
return rsaDecrypt(data,key);
}else{
return rsaDecrypt(data,key,option);
}
}else{
return false
}
}
};
/**
* 获取壳子返回的代理地址
* @returns {string|*}

2
libs/drpy.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -34,8 +34,15 @@ function init_test(){
// encryptor.setPublicKey(publicKey) // 设置公钥
// var str = encryptor.encrypt(text) // 对数据进行加密
// console.log("加密数据:" + str);
log('rsax:'+typeof(rsax));
log('rsaX:'+typeof(rsaX));
// log('rsax:'+typeof(rsax));
// log('rsaX:'+typeof(rsaX));
// let data = base64Encode('你好');
// let publicKey = 'dzyyds';
// console.log(typeof (RSA.encode));
// let encryptBase64Data = RSA.encode(data,publicKey);
// log('encryptBase64Data:'+encryptBase64Data);
// let str = RSA.decode(data,publicKey);
// log('str:'+str);
}
/**
@ -60,7 +67,7 @@ function pre(){
let rule = {};
let vercode = typeof(pdfl) ==='function'?'drpy2.1':'drpy2';
const VERSION = vercode+' 3.9.48beta4 20231004';
const VERSION = vercode+' 3.9.48beta8 20231004';
/**
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼最新的文件发现这问题已经解决了]
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
@ -442,6 +449,34 @@ function getCryptoJS(){
return 'console.log("CryptoJS已装载");'
}
// 封装的RSA加解密类
const RSA = {
encode:function (data,key,option){
// log('encode');
if(typeof(rsaEncrypt)==='function'){
if(!option||typeof(option)!=='object'){
return rsaEncrypt(data,key);
}else{
return rsaEncrypt(data,key,option);
}
}else{
return false
}
},
decode:function (data,key,option){
// log('decode');
if(typeof(rsaDecrypt)==='function'){
if(!option||typeof(option)!=='object'){
return rsaDecrypt(data,key);
}else{
return rsaDecrypt(data,key,option);
}
}else{
return false
}
}
};
/**
* 获取壳子返回的代理地址
* @returns {string|*}

2
libs/drpy2.min.js vendored

File diff suppressed because one or more lines are too long