mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
js添加签名算法
This commit is contained in:
@@ -218,6 +218,18 @@ cipher.encrypt(data, keyType)
|
||||
cipher.encryptBase64(data, keyType)
|
||||
cipher.encryptHex(data, keyType)
|
||||
```
|
||||
* 签名
|
||||
> 输入参数密钥 支持ByteArray|**Utf8String**
|
||||
```
|
||||
//创建Sign
|
||||
java.createSign(algorithm, privateKey, publicKey)
|
||||
```
|
||||
> 签名参数 data支持ByteArray|inputStream|String
|
||||
```
|
||||
//签名输出 ByteArray HexString
|
||||
sign.sign(data)
|
||||
sign.signHex(data)
|
||||
```
|
||||
* 摘要
|
||||
```
|
||||
java.digestHex(data: String, algorithm: String,): String?
|
||||
@@ -236,9 +248,6 @@ java.HMacHex(data: String, algorithm: String, key: String): String
|
||||
java.HMacBase64(data: String, algorithm: String, key: String): String
|
||||
```
|
||||
|
||||
https://developer.android.google.cn/reference/kotlin/java/security/Signature
|
||||
|
||||
|
||||
## book对象的可用属性和方法
|
||||
### 属性
|
||||
> 使用方法: 在js中或{{}}中使用book.属性的方式即可获取.如在正文内容后加上 ##{{book.name+"正文卷"+title}} 可以净化 书名+正文卷+章节名称(如 我是大明星正文卷第二章我爸是豪门总裁) 这一类的字符.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
**2023/03/13**
|
||||
* 更新cronet: 111.0.5563.57
|
||||
* 优化文件型书源,解决压缩文件编码不是UTF-8报错问题
|
||||
|
||||
* js添加非对称加密和签名算法
|
||||
* 文件类书源支持zip 7z rar4解压
|
||||
* java.ajax(url: Any)自动判断是列表还是字符串
|
||||
* 修复一些bug
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.util.Base64
|
||||
import cn.hutool.crypto.digest.DigestUtil
|
||||
import cn.hutool.crypto.digest.HMac
|
||||
import cn.hutool.crypto.asymmetric.AsymmetricCrypto
|
||||
import cn.hutool.crypto.asymmetric.Sign
|
||||
import cn.hutool.crypto.symmetric.SymmetricCrypto
|
||||
import io.legado.app.utils.MD5Utils
|
||||
|
||||
@@ -89,6 +90,26 @@ interface JsEncodeUtils {
|
||||
publicKey?.encodeToByteArray()
|
||||
)
|
||||
}
|
||||
//******************签名************************//
|
||||
fun createSign(
|
||||
algorithm: String,
|
||||
privateKey: String?,
|
||||
publicKey: String?
|
||||
): Sign {
|
||||
return createSign(
|
||||
algorithm
|
||||
privateKey?.encodeToByteArray(),
|
||||
publicKey?.encodeToByteArray()
|
||||
)
|
||||
}
|
||||
|
||||
fun createSign(
|
||||
algorithm: String,
|
||||
privateKey: ByteArray?,
|
||||
publicKey: ByteArray?
|
||||
): Sign {
|
||||
return Sign(algorithm, privateKey, publicKey)
|
||||
}
|
||||
//******************对称加密解密old************************//
|
||||
|
||||
/////AES
|
||||
|
||||
Reference in New Issue
Block a user