X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FCryptUtils.java;fp=src%2Fbe%2Fnikiroo%2Futils%2FCryptUtils.java;h=fdf05565b508c48f2c8d0722d2ce1b6a5a6cf38e;hb=ed3aa598b54187e347b384fceea901cc143f20f5;hp=b82a169ac21fffd4eb6d95f6df86c46a43566bfd;hpb=fbcc2a2acb39e4c0bbbc805ece1f8ecf2206f951;p=fanfix.git diff --git a/src/be/nikiroo/utils/CryptUtils.java b/src/be/nikiroo/utils/CryptUtils.java index b82a169..fdf0556 100644 --- a/src/be/nikiroo/utils/CryptUtils.java +++ b/src/be/nikiroo/utils/CryptUtils.java @@ -267,6 +267,28 @@ public class CryptUtils { } } + /** + * Decode the data which is assumed to be encrypted with the same utilities + * and to be a {@link String}. + * + * @param data + * the encrypted data to decode + * + * @return the original, decoded data,as a {@link String} + * + * @throws SSLException + * in case of I/O error + */ + public String decrypts(byte[] data) throws SSLException { + try { + return new String(decrypt(data), "UTF-8"); + } catch (UnsupportedEncodingException e) { + // UTF-8 is required in all confirm JVMs + e.printStackTrace(); + return null; + } + } + /** * Decode the data which is assumed to be encrypted with the same utilities * and is a Base64 encoded value.