public class CryptoUtils extends Object
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.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_PUBLIC_KEY_STRING |
| 构造器和说明 |
|---|
CryptoUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decrypt(PublicKey publicKey,
String cipherText) |
static String |
decrypt(String cipherText) |
static String |
decrypt(String publicKeyText,
String cipherText) |
static String |
encrypt(byte[] keyBytes,
String plainText) |
static String |
encrypt(String plainText) |
static String |
encrypt(String key,
String plainText) |
static String[] |
genKeyPair(int keySize) |
static byte[][] |
genKeyPairBytes(int keySize) |
static PublicKey |
getPublicKey(String publicKeyText) |
static PublicKey |
getPublicKeyByPublicKeyFile(String publicKeyFile) |
static PublicKey |
getPublicKeyByX509(String x509File) |
public static String decrypt(String publicKeyText, String cipherText) throws Exception
Exceptionpublic static PublicKey getPublicKeyByPublicKeyFile(String publicKeyFile)
public static String decrypt(PublicKey publicKey, String cipherText) throws Exception
Exceptionpublic static String encrypt(byte[] keyBytes, String plainText) throws Exception
Exceptionpublic static byte[][] genKeyPairBytes(int keySize)
public static String[] genKeyPair(int keySize)
Copyright © 2018–2022 baomidou. All rights reserved.