mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
e54e2a770e
commit
d28ae01cf0
@ -12,6 +12,8 @@
|
||||
* 【core 】 Convert.toNumber支持类似12.2F这种形式字符串转换(issue#I1VYLJ@Gitee)
|
||||
* 【core 】 使用静态变量替换999等(issue#I1W8IB@Gitee)
|
||||
* 【core 】 URLUtil自动trim(issue#I1W803@Gitee)
|
||||
* 【crypto 】 RC4增加ecrypt(pr#1108@Github)
|
||||
* 【core 】 CharUtil and StrUtil增加@(pr#1106@Github)
|
||||
|
||||
### Bug修复
|
||||
* 【crypto 】 修复SM2验签后无法解密问题(issue#I1W0VP@Gitee)
|
||||
|
@ -1,11 +1,5 @@
|
||||
package cn.hutool.crypto.symmetric;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
@ -13,6 +7,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.CryptoException;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
/**
|
||||
* RC4加密解密算法实现<br>
|
||||
* 来自:https://github.com/xSAVIKx/RC4-cipher/blob/master/src/main/java/com/github/xsavikx/rc4/RC4.java
|
||||
@ -103,6 +103,7 @@ public class RC4 implements Serializable {
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @return 加密后的Hex
|
||||
* @since 5.4.4
|
||||
*/
|
||||
public String encryptHex(String data) {
|
||||
return HexUtil.encodeHexStr(encrypt(data));
|
||||
@ -126,6 +127,7 @@ public class RC4 implements Serializable {
|
||||
*
|
||||
* @param data 被加密的字符串
|
||||
* @return 加密后的Base64
|
||||
* @since 5.4.4
|
||||
*/
|
||||
public String encryptBase64(String data) {
|
||||
return Base64.encode(encrypt(data));
|
||||
@ -159,6 +161,7 @@ public class RC4 implements Serializable {
|
||||
*
|
||||
* @param message 消息
|
||||
* @return 明文
|
||||
* @since 5.4.4
|
||||
*/
|
||||
public String decrypt(String message) {
|
||||
return decrypt(SecureUtil.decode(message));
|
||||
@ -170,6 +173,7 @@ public class RC4 implements Serializable {
|
||||
* @param message 明文
|
||||
* @param charset 解密后的charset
|
||||
* @return 明文
|
||||
* @since 5.4.4
|
||||
*/
|
||||
public String decrypt(String message, Charset charset) {
|
||||
return StrUtil.str(decrypt(message), charset);
|
||||
|
Loading…
x
Reference in New Issue
Block a user