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, toKey
public 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.CodecHelper
initKey
in class CodecUtils.CodecHelper
Exception
- if an error occurs.public String initKeyToString() throws Exception
initKeyToString
in class CodecUtils.CodecHelper
Exception
public PairObject<RSAPublicKey,RSAPrivateKey> initRSAKey() throws Exception
Exception
public boolean verify(byte[] data, String publicKey, String sign) throws Exception
Exception
public byte[] encrypt(byte[] data, byte[] key) throws Exception
CodecUtils.CodecHelper
encrypt
in class CodecUtils.CodecHelper
data
- 待加密数据key
- 密钥Exception
- if an error occurs.public String encrypt(String data, String key) throws Exception
encrypt
in class CodecUtils.CodecHelper
Exception
public byte[] decrypt(byte[] data, byte[] key) throws Exception
CodecUtils.CodecHelper
decrypt
in class CodecUtils.CodecHelper
data
- 待解密数据key
- 密钥Exception
- if an error occurs.public String decrypt(String data, String key) throws Exception
decrypt
in class CodecUtils.CodecHelper
Exception
public byte[] encryptPublicKey(byte[] data, byte[] key) throws Exception
Exception
public String encryptPublicKey(String data, String key) throws Exception
Exception
public byte[] decryptPublicKey(byte[] data, byte[] key) throws Exception
Exception
Copyright © 2022. All rights reserved.