/***
* RSA加解密
*
* RSA数据加解密方式
*
1.明文-->公钥加密-->密文-->私钥解密-->明文*
2.明文-->私钥加密-->密文-->公钥解密-->明文*
* SRA密钥说明
*
相关参数:公钥指数publicExponent,私钥指数privateExponent,模值modulus*
key = fun(modulus,exponent) {@link#getPublicKey(BigInteger, BigInteger)}*
key = fun(encodedKey) {@link#getPublicKey(byte[])}*
*@authorsvili
* @date 2017年9月8日
**/
public classRSAUtil {/**RSA密文长度:128byte(字节)*/
private final static int DECRYPT_BLOCK_CAPACITY = 2 << 6;/**RSA明文长度:117byte(字节),padding=11byte(字节)*/
private final static int ENCRYPT_BLOCK_CAPACITY = (2 << 6) - 11;private static classGeneratorHolder {/**RSA秘钥生成器*/
private staticKeyPairGenerator keyPairGenerator;static{//静态内部类实现单例模式
try{
keyPairGenerator= KeyPairGenerator.get