List of usage examples for org.apache.shiro.codec CodecSupport toBytes
public static byte[] toBytes(String source, String encoding) throws CodecException
From source file:de.elomagic.mag.utils.SimpleCrypt.java
License:Apache License
public static String encrypt(String decrypted) throws IOException { try {//from www . j av a 2 s . com byte[] secretBytes = CodecSupport.toBytes(decrypted, "utf-8"); ByteSource encrypted = CIPHER.encrypt(secretBytes, getMasterKey()); return "{" + encrypted.toBase64() + "}"; } catch (Exception ex) { LOGGER.error(ex.getMessage(), ex); throw (ex); } }