mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package cn.hutool.crypto;
|
||||
|
||||
import cn.hutool.core.io.FastByteArrayOutputStream;
|
||||
import cn.hutool.core.io.stream.FastByteArrayOutputStream;
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import org.bouncycastle.asn1.ASN1Encodable;
|
||||
import org.bouncycastle.asn1.ASN1Encoding;
|
||||
|
@@ -122,7 +122,7 @@ public class PemUtil {
|
||||
* @since 4.5.2
|
||||
*/
|
||||
public static PemObject readPemObject(final InputStream keyStream) {
|
||||
return readPemObject(IoUtil.getUtf8Reader(keyStream));
|
||||
return readPemObject(IoUtil.toUtf8Reader(keyStream));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ public class PemUtil {
|
||||
* @since 5.1.6
|
||||
*/
|
||||
public static void writePemObject(final PemObjectGenerator pemObject, final OutputStream keyStream) {
|
||||
writePemObject(pemObject, IoUtil.getUtf8Writer(keyStream));
|
||||
writePemObject(pemObject, IoUtil.toUtf8Writer(keyStream));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.crypto.asymmetric;
|
||||
|
||||
import cn.hutool.core.codec.BaseN.Base64;
|
||||
import cn.hutool.core.io.FastByteArrayOutputStream;
|
||||
import cn.hutool.core.io.stream.FastByteArrayOutputStream;
|
||||
import cn.hutool.crypto.CipherWrapper;
|
||||
import cn.hutool.crypto.CryptoException;
|
||||
import cn.hutool.crypto.KeyUtil;
|
||||
|
@@ -54,18 +54,6 @@ public interface AsymmetricEncryptor {
|
||||
return Base64.encode(encrypt(data, keyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @param charset 编码
|
||||
* @param keyType 私钥或公钥 {@link KeyType}
|
||||
* @return 加密后的bytes
|
||||
*/
|
||||
default byte[] encrypt(final String data, final String charset, final KeyType keyType) {
|
||||
return encrypt(StrUtil.bytes(data, charset), keyType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
|
@@ -62,17 +62,6 @@ public interface SymmetricEncryptor {
|
||||
return Base64.encode(encrypt(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @param charset 编码
|
||||
* @return 加密后的bytes
|
||||
*/
|
||||
default byte[] encrypt(final String data, final String charset) {
|
||||
return encrypt(StrUtil.bytes(data, charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
@@ -84,17 +73,6 @@ public interface SymmetricEncryptor {
|
||||
return encrypt(StrUtil.bytes(data, charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @param charset 编码
|
||||
* @return 加密后的Hex
|
||||
*/
|
||||
default String encryptHex(final String data, final String charset) {
|
||||
return HexUtil.encodeHexStr(encrypt(data, charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
@@ -106,17 +84,6 @@ public interface SymmetricEncryptor {
|
||||
return HexUtil.encodeHexStr(encrypt(data, charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @param charset 编码
|
||||
* @return 加密后的Base64
|
||||
*/
|
||||
default String encryptBase64(final String data, final String charset) {
|
||||
return Base64.encode(encrypt(data, charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
|
Reference in New Issue
Block a user