public final class EncoderDecoder extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
decode(String encodedString,
String key,
byte[] salt)
Decrypts the given encoded string using the given secret key.
|
static String |
encode(String clearText,
String key,
byte[] salt)
Given a secret key, this will encode the given clear text message and return the encoded string.
|
public static String encode(String clearText, String key, byte[] salt) throws Exception
decode(String, String, byte[]).clearText - the message to encrypt (if null, then null is returned)key - the secret key used to encrypt the clear text string (must not be null)salt - random sequence to be used with the key to encrypt the clear text string (must not be null)IllegalArgumentException - if the key and/or salt is null or if the salt is of a wrong sizeException - on errorpublic static String decode(String encodedString, String key, byte[] salt) throws Exception
encode(String, String, byte[]) method with the same key in order
for the decode to work.encodedString - the encoded message (if null, then null is returned)key - the key that was used to encode the string (must not be null)salt - random sequence that was used to with the key to encode the string (must not be null)IllegalArgumentException - if the key and/or salt is null or if the salt is of a wrong sizeException - on errorCopyright © 2015–2017 Red Hat, Inc.. All rights reserved.