public class DataEncryptor extends Object
DataEncryptor
is used to encrypt the data
with symmetric and asymmetric keys.Constructor and Description |
---|
DataEncryptor() |
Modifier and Type | Method and Description |
---|---|
static String |
decryptWithAsymmetricKey(String data,
String encAlgorithm,
Key encKey)
Decrypts the given data with asymmetric key.
|
static String |
decryptWithSymmetricKey(String data,
String encAlgorithm,
String secret)
Decrypts the given data with a symmetric key generated using shared
secret.
|
static String |
encryptWithAsymmetricKey(String data,
String encryptionAlgorithm,
int encryptionStrength,
Key encKey)
Encrypts the given data with an asymmetric key.
|
static String |
encryptWithSymmetricKey(String data,
String encAlgorithm,
String secret)
Encrypts the given data with a symmetric key that was generated
using given shared secret.
|
public DataEncryptor()
public static String encryptWithAsymmetricKey(String data, String encryptionAlgorithm, int encryptionStrength, Key encKey)
data
- the data to be encrypted.encryptionAlgorithm
- the encryption algorithm to be used.
The encryption algorithm must be one of the supported
algorithm by the underlying JCE encryption provider.
Examples of encryption algorithms are "DES", "AES" etc.encryptionStrength
- the encryption strength for a given
encryption algorithm.encKey
- the encryption key to be used. For PKI, this
key should be public key of the intended recipient.public static String decryptWithAsymmetricKey(String data, String encAlgorithm, Key encKey)
data
- the data to be decrypted.encAlgorithm
- the encryption algorithm was used for encrypted
data.encKey
- the private key for decrypting the data.public static String encryptWithSymmetricKey(String data, String encAlgorithm, String secret)
data
- the data to be encrypted.encAlgorithm
- the encryption algorithm to be used.
The encryption algorithm must be one of the supported
algorithm by the underlying JCE encryption provider.
For password based encryptions, the encryption algorithm
PBEWithMD5AndDES is commonly used.secret
- the shared secret to be used for symmetric encryption.public static String decryptWithSymmetricKey(String data, String encAlgorithm, String secret)
data
- the data to be decrypted with symmetric key.encAlgorithm
- the encryption algorithm was used for
encrypting the data.secret
- the shared secret to be used for decrypting the data.Copyright © 2010-2016, ForgeRock All Rights Reserved.