* @throws ServerCryptoException
* if an error occurs, for example if the wrong pass phrase is used
*/
public static String decryptString(String encrypted, String passPhrase) throws ServerCryptoException {
try {
PBEStringCryptographer crypto = new DefaultPBEStringCryptographer(salt, 1);
crypto.setAlgorithm(algorithm);
crypto.setPassphrase(passPhrase);
Base64 base64 = new Base64();
byte[] bytes = base64.decode(encrypted.getBytes());
return crypto.decrypt(bytes);
} catch (StringCryptographerException ex) {
throw new ServerCryptoException(ex);
} catch (StringDecrypterException ex) {
throw new ServerCryptoException(ex);
}