类 CryptoUtils
java.lang.Object
com.baomidou.dynamic.datasource.toolkit.CryptoUtils
Copyright 1999-2018 Alibaba Group Holding Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- 作者:
- alibaba
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String解密算法 RSAstatic String解密算法 RSAstatic String解密算法 RSAstatic String加密算法 RSAstatic String加密算法 RSAstatic String加密算法 RSAstatic String[]genKeyPair(int keySize) 生成密钥对static byte[][]genKeyPairBytes(int keySize) 生成密钥对static PublicKeygetPublicKey(String publicKeyText) 加密算法 RSAstatic PublicKeygetPublicKeyByPublicKeyFile(String publicKeyFile) 加密算法RSA 通过公钥文件获取公钥static PublicKeygetPublicKeyByX509(String x509File) 加密算法 RSA
-
字段详细资料
-
DEFAULT_PUBLIC_KEY_STRING
- 另请参阅:
-
-
构造器详细资料
-
CryptoUtils
public CryptoUtils()
-
-
方法详细资料
-
decrypt
解密算法 RSA- 参数:
cipherText- - 需要解密的字符串- 返回:
- String - 解密后的字符串
- 抛出:
Exception- - 解密过程中的异常信息
-
decrypt
解密算法 RSA- 参数:
publicKeyText- - 公钥cipherText- - 需要解密的字符串- 返回:
- String - 解密后的字符串
- 抛出:
Exception- - 解密过程中的异常信息
-
getPublicKeyByX509
加密算法 RSA- 参数:
x509File- - 公钥文件- 返回:
- PublicKey - 加密后的字符串
-
getPublicKey
加密算法 RSA- 参数:
publicKeyText- - 公钥字符串- 返回:
- PublicKey - 公钥
-
getPublicKeyByPublicKeyFile
加密算法RSA 通过公钥文件获取公钥- 参数:
publicKeyFile- - 公钥文件- 返回:
- PublicKey - 加密后的字符串
-
decrypt
解密算法 RSA- 参数:
publicKey- - 公钥cipherText- - 需要解密的字符串- 返回:
- String - 解密后的字符串
- 抛出:
Exception- - 解密过程中的异常信息
-
encrypt
加密算法 RSA- 参数:
plainText- - 需要加密的字符串- 返回:
- String - 加密后的字符串
- 抛出:
Exception- - 加密过程中的异常信息
-
encrypt
加密算法 RSA- 参数:
key- - 加密的密钥plainText- - 需要加密的字符串- 返回:
- String - 加密后的字符串
- 抛出:
Exception- - 加密过程中的异常信息
-
encrypt
加密算法 RSA- 参数:
keyBytes- - 加密的密钥plainText- - 需要加密的字符串- 返回:
- String - 加密后的字符串
- 抛出:
Exception- - 加密过程中的异常信息
-
genKeyPairBytes
public static byte[][] genKeyPairBytes(int keySize) 生成密钥对- 参数:
keySize- - 密钥对长度- 返回:
- byte[][] - 密钥对
-
genKeyPair
生成密钥对- 参数:
keySize- - 密钥对长度- 返回:
- String[] - Base64编码后的密钥对
-