mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -32,7 +32,7 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
||||
|
||||
@JvmOverloads
|
||||
fun decrypt(data: Any, usePublicKey: Boolean? = true): ByteArray {
|
||||
return {
|
||||
return when {
|
||||
data is ByteArray -> decrypt(data, getKeyType(usePublicKey))
|
||||
data is String -> decrypt(data, getKeyType(usePublicKey))
|
||||
data is InputStream -> decrypt(data, getKeyType(usePublicKey))
|
||||
@@ -42,7 +42,7 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
||||
|
||||
@JvmOverloads
|
||||
fun decryptStr(data: Any, usePublicKey: Boolean? = true): String {
|
||||
return {
|
||||
return when {
|
||||
data is ByteArray -> decryptStr(data, getKeyType(usePublicKey))
|
||||
data is String -> decryptStr(data, getKeyType(usePublicKey))
|
||||
data is InputStream -> decryptStr(data, getKeyType(usePublicKey))
|
||||
@@ -52,7 +52,7 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
||||
|
||||
@JvmOverloads
|
||||
fun encrypt(data: Any, usePublicKey: Boolean? = true): ByteArray {
|
||||
return {
|
||||
return when {
|
||||
data is ByteArray -> encrypt(data, getKeyType(usePublicKey))
|
||||
data is String -> encrypt(data, getKeyType(usePublicKey))
|
||||
data is InputStream -> encrypt(data, getKeyType(usePublicKey))
|
||||
@@ -62,7 +62,7 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
||||
|
||||
@JvmOverloads
|
||||
fun encryptHex(data: Any, usePublicKey: Boolean? = true): String {
|
||||
return {
|
||||
return when {
|
||||
data is ByteArray -> encryptHex(data, getKeyType(usePublicKey))
|
||||
data is String -> encryptHex(data, getKeyType(usePublicKey))
|
||||
data is InputStream -> encryptHex(data, getKeyType(usePublicKey))
|
||||
@@ -72,7 +72,7 @@ class AsymmetricCrypto(algorithm: String) : HutoolAsymmetricCrypto(algorithm) {
|
||||
|
||||
@JvmOverloads
|
||||
fun encryptBase64(data: Any, usePublicKey: Boolean? = true): String {
|
||||
return {
|
||||
return when {
|
||||
data is ByteArray -> encryptBase64(data, getKeyType(usePublicKey))
|
||||
data is String -> encryptBase64(data, getKeyType(usePublicKey))
|
||||
data is InputStream -> encryptBase64(data, getKeyType(usePublicKey))
|
||||
|
||||
Reference in New Issue
Block a user