public class RsaCipher extends java.lang.Object implements EncryptionCipher, DecryptionCipher
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PRIVATE_KEY_FILENAME |
static java.lang.String |
PUBLIC_KEY_FILENAME |
| Constructor and Description |
|---|
RsaCipher(java.io.File keyDirectory) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] data)
Decrypts the specified data.
|
byte[] |
encrypt(byte[] data)
Encrypts the specified data.
|
byte[] |
encrypt(byte[] data,
java.security.PublicKey publicKey) |
byte[] |
getPublicKey() |
void |
init()
Initializes the cipher instance.
|
public static final java.lang.String PRIVATE_KEY_FILENAME
public static final java.lang.String PUBLIC_KEY_FILENAME
public void init()
throws java.lang.Exception
EncryptionCipherinit in interface DecryptionCipherinit in interface EncryptionCipherjava.lang.Exceptionpublic byte[] decrypt(byte[] data)
throws java.security.GeneralSecurityException
DecryptionCipherdecrypt in interface DecryptionCipherdata - the data to decrypt.java.security.GeneralSecurityExceptionpublic byte[] encrypt(byte[] data)
throws java.security.GeneralSecurityException
EncryptionCipherencrypt in interface EncryptionCipherdata - the data to encrypt.java.security.GeneralSecurityExceptionpublic byte[] encrypt(byte[] data,
java.security.PublicKey publicKey)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic byte[] getPublicKey()