Class Crypto.RSA
java.lang.Object
com.almis.awe.model.util.security.Crypto.RSA
- Enclosing class:
- Crypto
RSA
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDecrypt textEncrypt textGet exponentGet modulusGet private keyGet public key
-
Constructor Details
-
RSA
Constructor- Throws:
NoSuchAlgorithmException
- No such algorithmInvalidKeySpecException
- Invalid keyNoSuchPaddingException
- No such padding
-
-
Method Details
-
getModulus
Get modulus- Returns:
- Modulus
-
getExponent
Get exponent- Returns:
- Exponent
-
getPublicKey
Get public key- Returns:
- Public key
-
getPrivateKey
Get private key- Returns:
- Private key
-
encrypt
public String encrypt(String plaintext) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException Encrypt text- Parameters:
plaintext
- Text to encrypt- Returns:
- encrypted text
- Throws:
IllegalBlockSizeException
- illegal block size exceptionBadPaddingException
- bad padding exceptionInvalidKeyException
- invalid key exception
-
decrypt
public String decrypt(String ciphertext, String encoding) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException Decrypt text- Parameters:
ciphertext
- Encrypted textencoding
- encoding- Returns:
- Decrypted text
- Throws:
IllegalBlockSizeException
- illegal block size exceptionBadPaddingException
- bad padding exceptionInvalidKeyException
- invalid key exception
-