This commit is contained in:
Xwite
2023-03-15 10:41:37 +08:00
parent 8866969f99
commit c83a31f52d

View File

@@ -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))