de.innovationgate.utils.security
public class RSAEncrypter extends java.lang.Object
Note: To be able to decrypt the data again the receiver of the encrypted data needs both the DES-ENCRYPTED DATA and the RSA-ENCRYPTED DES KEY!
Modifier and Type | Class and Description |
---|---|
static class |
RSAEncrypter.RSAEncryptedData
Encrypted data created by RSAEncrypter
|
Constructor and Description |
---|
RSAEncrypter(RSAKeyPair keyPair,
java.lang.String passphrase) |
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(RSAEncrypter.RSAEncryptedData input)
Decrypts the given RSAEncryptedData
|
java.lang.Object |
decryptItemValue(java.lang.Object value)
Decrypts the given item value if it is RSA encryped.
|
RSAEncrypter.RSAEncryptedData |
encrypt(byte[] data)
Encrypt data by the given rsaKeyPair.
|
java.lang.String |
encryptItemValue(java.lang.Object value)
Encrypts the given item value to a string, which again can be stored as item value
|
public RSAEncrypter(RSAKeyPair keyPair, java.lang.String passphrase)
public RSAEncrypter.RSAEncryptedData encrypt(byte[] data) throws java.security.GeneralSecurityException, java.io.IOException
data
- The data to encryptjava.security.GeneralSecurityException
java.io.IOException
public byte[] decrypt(RSAEncrypter.RSAEncryptedData input) throws java.security.GeneralSecurityException, java.io.IOException, DESEncrypter.PersistentKeyException, IncorrectPassphraseException
input
- java.security.GeneralSecurityException
java.io.IOException
IncorrectPassphraseException
DESEncrypter.PersistentKeyException
public java.lang.Object decryptItemValue(java.lang.Object value) throws java.io.IOException, java.security.GeneralSecurityException, DESEncrypter.PersistentKeyException, IncorrectPassphraseException
value
- The item valuejava.io.IOException
java.security.GeneralSecurityException
DESEncrypter.PersistentKeyException
IncorrectPassphraseException
public java.lang.String encryptItemValue(java.lang.Object value) throws java.io.IOException, java.security.GeneralSecurityException
value
- The item value to encryptjava.io.IOException
java.security.GeneralSecurityException