mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add Base58
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.hutool.crypto;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@@ -22,6 +23,7 @@ import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
@@ -988,4 +990,14 @@ public class KeyUtil {
|
||||
throw new CryptoException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将密钥编码为Base64格式
|
||||
* @param key 密钥
|
||||
* @return Base64格式密钥
|
||||
* @since 5.7.22
|
||||
*/
|
||||
public static String toBase64(Key key){
|
||||
return Base64.encode(key.getEncoded());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user