- java.lang.Object
-
- com.codingapi.springboot.framework.crypto.RSA
-
public class RSA extends Object
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringKEY_ALGORITHM
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 byte[]decrypt(byte[] text)Decrypt text using private keybyte[]encrypt(byte[] text)Encrypt a text using public key.KeyPairgenerateKey()Generate key which contains a pair of privae and public key using 2048 bytesbyte[]getPrivateKey()byte[]getPublicKey()
-
-
-
构造器详细资料
-
RSA
public RSA() throws NoSuchAlgorithmException
-
RSA
public RSA(KeyPair keyPair)
-
RSA
public RSA(PrivateKey privateKey, PublicKey publicKey)
-
-
方法详细资料
-
generateKey
public KeyPair generateKey() throws NoSuchAlgorithmException
Generate key which contains a pair of privae and public key using 2048 bytes- 返回:
- key pair
- 抛出:
NoSuchAlgorithmException
-
getPrivateKey
public byte[] getPrivateKey()
-
getPublicKey
public byte[] getPublicKey()
-
encrypt
public byte[] encrypt(byte[] text) throws ExceptionEncrypt a text using public key.- 参数:
text- The original unencrypted text- 返回:
- Encrypted text
- 抛出:
Exception
-
-