-
- All Implemented Interfaces:
public class RSACrypt
Encrypt and decrypt bytes or a string.
-
-
Method Summary
Modifier and Type Method Description static String
encrypt(PublicKey publicKey, String message)
Encrypt a string with an RSA public key. static String
encrypt(PublicKey publicKey, Array<byte> bytes)
Encrypt a byte array with an RSA public key. static String
decryptToString(PrivateKey privateKey, String message)
Decrypt a base 64 encrypted message with an RSA private key. static Array<byte>
decryptToBytes(PrivateKey privateKey, String message)
Decrypt a base 64 encrypted message with an RSA private key. -
-
Method Detail
-
encrypt
static String encrypt(PublicKey publicKey, String message)
Encrypt a string with an RSA public key.
- Parameters:
publicKey
- The public key which is used to encrypt the message.message
- The message to encrypt.
-
encrypt
static String encrypt(PublicKey publicKey, Array<byte> bytes)
Encrypt a byte array with an RSA public key.
- Parameters:
publicKey
- The public key which is used to encrypt the bytes.bytes
- The bytes to encrypt.
-
decryptToString
static String decryptToString(PrivateKey privateKey, String message)
Decrypt a base 64 encrypted message with an RSA private key.
- Parameters:
privateKey
- The private key which is used to decrypt the message.message
- The base 64 encrypted message to encrypt.
-
decryptToBytes
static Array<byte> decryptToBytes(PrivateKey privateKey, String message)
Decrypt a base 64 encrypted message with an RSA private key.
- Parameters:
privateKey
- The private key which is used to decrypt the message.message
- The base 64 encrypted message to encrypt.
-
-
-
-