fix
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
* java.ajax(url: Any)自动判断是列表还是字符串
|
* java.ajax(url: Any)自动判断是列表还是字符串
|
||||||
* 修复一些bug
|
* 修复一些bug
|
||||||
* 其中一些更新由 Xwite, Horis, ag2s20150909 提供
|
* 其中一些更新由 Xwite, Horis, ag2s20150909 提供
|
||||||
|
* 修复js加密算法
|
||||||
|
|
||||||
**2023/03/12**
|
**2023/03/12**
|
||||||
|
|
||||||
|
|||||||
@@ -31,24 +31,37 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun decrypt(data: ByteArray, keyType: Int): ByteArray = decrypt(data, getKeyType(keyType))
|
fun decrypt(data: Any, keyType: Int): ByteArray = when {
|
||||||
fun decrypt(data: String, keyType: Int): ByteArray = decrypt(data, getKeyType(keyType))
|
data is ByteArray -> decrypt(data, getKeyType(keyType))
|
||||||
fun decrypt(data: InputStream, keyType: Int): ByteArray = decrypt(data, getKeyType(keyType))
|
data is String -> decrypt(data, getKeyType(keyType))
|
||||||
|
data is InputStream -> decrypt(data, getKeyType(keyType))
|
||||||
|
else -> throw IllegalArgumentException("Unexpected data input")
|
||||||
|
}
|
||||||
|
fun decryptStr(data: Any, keyType: Int): String = when {
|
||||||
|
data is ByteArray -> decryptStr(data, getKeyType(keyType))
|
||||||
|
data is String -> decryptStr(data, getKeyType(keyType))
|
||||||
|
data is InputStream -> decryptStr(data, getKeyType(keyType))
|
||||||
|
else -> throw IllegalArgumentException("Unexpected data input")
|
||||||
|
}
|
||||||
|
|
||||||
fun decryptStr(data: ByteArray, keyType: Int): String = decryptStr(data, getKeyType(keyType))
|
fun encrypt(data: Any, keyType: Int): ByteArray = when {
|
||||||
fun decryptStr(data: String, keyType: Int): String = decryptStr(data, getKeyType(keyType))
|
data is ByteArray -> encrypt(data, getKeyType(keyType))
|
||||||
fun decryptStr(data: InputStream, keyType: Int): String = decryptStr(data, getKeyType(keyType))
|
data is String -> encrypt(data, getKeyType(keyType))
|
||||||
|
data is InputStream -> encrypt(data, getKeyType(keyType))
|
||||||
|
else -> throw IllegalArgumentException("Unexpected data input")
|
||||||
|
}
|
||||||
|
fun encryptHex(data: Any, keyType: Int): String = when {
|
||||||
|
data is ByteArray -> encryptHex(data, getKeyType(keyType))
|
||||||
|
data is String -> encryptHex(data, getKeyType(keyType))
|
||||||
|
data is InputStream -> encryptHex(data, getKeyType(keyType))
|
||||||
|
else -> throw IllegalArgumentException("Unexpected data input")
|
||||||
|
}
|
||||||
|
fun encryptBase64(data: Any, keyType: Int): String = when {
|
||||||
|
data is ByteArray -> encryptBase64(data, getKeyType(keyType))
|
||||||
|
data is String -> encryptBase64(data, getKeyType(keyType))
|
||||||
|
data is InputStream -> encryptBase64(data, getKeyType(keyType))
|
||||||
|
else -> throw IllegalArgumentException("Unexpected data input")
|
||||||
|
}
|
||||||
|
|
||||||
fun encrypt(data: ByteArray, keyType: Int): ByteArray = encrypt(data, getKeyType(keyType))
|
|
||||||
fun encrypt(data: String, keyType: Int): ByteArray = encrypt(data, getKeyType(keyType))
|
|
||||||
fun encrypt(data: InputStream, keyType: Int): ByteArray = encrypt(data, getKeyType(keyType))
|
|
||||||
|
|
||||||
fun encryptHex(data: ByteArray, keyType: Int): String = encryptHex(data, getKeyType(keyType))
|
|
||||||
fun encryptHex(data: String, keyType: Int): String = encryptHex(data, getKeyType(keyType))
|
|
||||||
fun encryptHex(data: InputStream, keyType: Int): String = encryptHex(data, getKeyType(keyType))
|
|
||||||
|
|
||||||
fun encryptBase64(data: Any, keyType: Int): String =encryptBase64(data, getKeyType(keyType))
|
|
||||||
fun encryptBase64(data: Any, keyType: Int): String =encryptBase64(data, getKeyType(keyType))
|
|
||||||
fun encryptBase64(data: Any, keyType: Int): String =encryptBase64(data, getKeyType(keyType))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user