List of usage examples for org.apache.shiro.codec CodecSupport toString
public static String toString(byte[] bytes, String encoding) throws CodecException
From source file:de.elomagic.mag.utils.SimpleCrypt.java
License:Apache License
public static String decrypt(String encryptedBase64) throws IOException { try {// w w w.jav a 2 s . co m if (!isEncryptedValue(encryptedBase64)) { throw new IOException("This value is not encapsulated as an encrypted value. Unable to decrypt."); } byte[] encryptedBytes = Base64.decode(encryptedBase64.substring(1, encryptedBase64.length() - 1)); ByteSource decrypted = CIPHER.decrypt(encryptedBytes, getMasterKey()); return CodecSupport.toString(decrypted.getBytes(), "utf-8"); } catch (Exception ex) { LOGGER.error(ex.getMessage(), ex); throw ex; } }