public static class CodecUtils.RSACodecHelper extends CodecUtils.CodecHelper
CIPHER_ALGORITHM, KEY_ALGORITHM, KEY_SIZE| Constructor and Description |
|---|
RSACodecHelper(int keySize) |
RSACodecHelper(int keySize,
String cipherAlgorithm) |
RSACodecHelper(int keySize,
String signatureAlgorithm,
Provider signatureAlgorithmProvider) |
RSACodecHelper(int keySize,
String cipherAlgorithm,
Provider cipherAlgorithmProvider,
String signatureAlgorithm,
Provider signatureAlgorithmProvider) |
RSACodecHelper(int keySize,
String cipherAlgorithm,
String signatureAlgorithm,
Provider signatureAlgorithmProvider) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] data,
byte[] key)
解密数据
|
String |
decrypt(String data,
String key) |
byte[] |
decryptPublicKey(byte[] data,
byte[] key) |
String |
decryptPublicKey(String data,
String key) |
byte[] |
encrypt(byte[] data,
byte[] key)
加密数据
|
String |
encrypt(String data,
String key) |
byte[] |
encryptPublicKey(byte[] data,
byte[] key) |
String |
encryptPublicKey(String data,
String key) |
int |
getMaxDecryptBlockSize() |
int |
getMaxEncryptBlockSize() |
String |
getRSAKey(Key rsaKey) |
byte[] |
initKey()
生成密钥
|
String |
initKeyToString() |
PairObject<RSAPublicKey,RSAPrivateKey> |
initRSAKey() |
CodecUtils.RSACodecHelper |
maxDecryptBlockSize(int maxDecryptBlockSize) |
CodecUtils.RSACodecHelper |
maxEncryptBlockSize(int maxEncryptBlockSize) |
byte[] |
sign(byte[] data,
String privateKey) |
String |
sign(String data,
String privateKey) |
boolean |
verify(byte[] data,
String publicKey,
String sign) |
getCipherInstance, toKeypublic RSACodecHelper(int keySize)
public RSACodecHelper(int keySize,
String signatureAlgorithm,
Provider signatureAlgorithmProvider)
public RSACodecHelper(int keySize,
String cipherAlgorithm)
public RSACodecHelper(int keySize,
String cipherAlgorithm,
String signatureAlgorithm,
Provider signatureAlgorithmProvider)
public int getMaxEncryptBlockSize()
public CodecUtils.RSACodecHelper maxEncryptBlockSize(int maxEncryptBlockSize)
public int getMaxDecryptBlockSize()
public CodecUtils.RSACodecHelper maxDecryptBlockSize(int maxDecryptBlockSize)
public byte[] initKey()
throws Exception
CodecUtils.CodecHelperinitKey in class CodecUtils.CodecHelperException - if an error occurs.public String initKeyToString() throws Exception
initKeyToString in class CodecUtils.CodecHelperExceptionpublic PairObject<RSAPublicKey,RSAPrivateKey> initRSAKey() throws Exception
Exceptionpublic boolean verify(byte[] data,
String publicKey,
String sign)
throws Exception
Exceptionpublic byte[] encrypt(byte[] data,
byte[] key)
throws Exception
CodecUtils.CodecHelperencrypt in class CodecUtils.CodecHelperdata - 待加密数据key - 密钥Exception - if an error occurs.public String encrypt(String data, String key) throws Exception
encrypt in class CodecUtils.CodecHelperExceptionpublic byte[] decrypt(byte[] data,
byte[] key)
throws Exception
CodecUtils.CodecHelperdecrypt in class CodecUtils.CodecHelperdata - 待解密数据key - 密钥Exception - if an error occurs.public String decrypt(String data, String key) throws Exception
decrypt in class CodecUtils.CodecHelperExceptionpublic byte[] encryptPublicKey(byte[] data,
byte[] key)
throws Exception
Exceptionpublic String encryptPublicKey(String data, String key) throws Exception
Exceptionpublic byte[] decryptPublicKey(byte[] data,
byte[] key)
throws Exception
ExceptionCopyright © 2022. All rights reserved.