public final class Crypto extends Object
| Constructor and Description |
|---|
Crypto()
Construct a Crypto instance with the default encryption provider.
|
Crypto(KeyProvider keyProvider)
Construct a Crypto instance with the given encryption provider.
|
| Modifier and Type | Method and Description |
|---|---|
String |
decrypt(String secret)
Decrypts the provided secret.
|
static String |
decryptIfNecessary(String value)
Tries to decrypt the value if and only if this is necessary.
|
String |
encrypt(String secret)
Encrypt the provided secret.
|
public Crypto()
public Crypto(KeyProvider keyProvider)
keyProvider - The encryption provider to use.public String encrypt(String secret) throws GeneralSecurityException
secret - The password or other secret to encrypt.GeneralSecurityException - If something goes wrong with the encryption (wrong key size/algorithm/etc).public String decrypt(String secret) throws GeneralSecurityException
secret - The password or other secret to decrypt.GeneralSecurityException - If something goes wrong with the encryption (wrong key size/algorithm/etc).public static String decryptIfNecessary(String value) throws GeneralSecurityException
ENCRYPTED_PREFIX and has at least one character after.value - value to be processed.GeneralSecurityException - in case of decryption error.Copyright © 2016 SDL Group. All rights reserved.