public class RSAUtils extends Object
| Constructor and Description |
|---|
RSAUtils() |
| Modifier and Type | Method and Description |
|---|---|
static RSAKeyPairEntry |
generateRSAKeyPair() |
static String |
sign(String content,
PrivateKey privateKey)
if has performance problem ,change Signature to ThreadLocal instance
|
static boolean |
verify(String publicKey,
String sign,
String content)
if has performance problem ,change Signature to ThreadLocal instance
|
public static RSAKeyPairEntry generateRSAKeyPair()
public static String sign(String content, PrivateKey privateKey) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException
public static boolean verify(String publicKey, String sign, String content) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, SignatureException
publicKey - public key after base64 encodesign - 签名content - original contentNoSuchAlgorithmExceptionInvalidKeySpecExceptionInvalidKeyExceptionSignatureExceptionCopyright © 2017–2022 The Apache Software Foundation. All rights reserved.