public class RSA
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ALGORITHM_NAME |
private static java.lang.String |
ALGORITHM_STRING
String containing all the information for enryption (algorithm name, mode of operation, padding scheme)
|
private static java.lang.String |
MODE_OF_OPERATION
The RSA mde of operation
|
private static java.lang.String |
PADDING_SCHEME
The padding scheme used when encrypting with RSA, required to ensure good security
|
private static int |
RSA_KEY_LENGTH
The size of the RSA keys.
|
Constructor and Description |
---|
RSA() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decrypt(byte[] encryptedMessage,
java.security.PrivateKey privateKey)
Decrypt a byte array using RSA algorithm
|
static byte[] |
encrypt(byte[] bytes,
java.security.PublicKey publicKey)
Encrypt a byte array using RSA algorithm
|
static java.security.KeyPair |
generateKeyPair() |
private static final int RSA_KEY_LENGTH
private static final java.lang.String ALGORITHM_NAME
private static final java.lang.String PADDING_SCHEME
private static final java.lang.String MODE_OF_OPERATION
private static final java.lang.String ALGORITHM_STRING
public static java.security.KeyPair generateKeyPair()
public static byte[] encrypt(byte[] bytes, java.security.PublicKey publicKey)
bytes
- publicKey
- public static byte[] decrypt(byte[] encryptedMessage, java.security.PrivateKey privateKey)
encryptedMessage
- privateKey
-