From 987ef0186f65e99a6db1eccc9ffc0e790863374f Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Sat, 27 Jan 2007 12:49:42 +0000 Subject: [PATCH] bug fix [ 1598095 ] class Secure is not working with UTF8 --- looks/src/org/compiere/util/Secure.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/looks/src/org/compiere/util/Secure.java b/looks/src/org/compiere/util/Secure.java index d709d8fe58..545a787afd 100644 --- a/looks/src/org/compiere/util/Secure.java +++ b/looks/src/org/compiere/util/Secure.java @@ -23,8 +23,13 @@ import java.util.logging.*; import javax.crypto.*; /** - * Security Services. - * + * Security Services. + *

+ * Change log: + *

+ * * @author Jorg Janke * @version $Id: Secure.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ */ @@ -184,7 +189,7 @@ public class Secure implements SecureInterface try { m_cipher.init(Cipher.ENCRYPT_MODE, m_key); - byte[] encBytes = m_cipher.doFinal(clearText.getBytes()); + byte[] encBytes = m_cipher.doFinal(clearText.getBytes("UTF8")); String encString = convertToHexString(encBytes); // globalqss - [ 1577737 ] Security Breach - show database password // log.log (Level.ALL, value + " => " + encString); @@ -238,7 +243,7 @@ public class Secure implements SecureInterface AlgorithmParameters ap = m_cipher.getParameters(); m_cipher.init(Cipher.DECRYPT_MODE, m_key, ap); byte[] out = m_cipher.doFinal(data); - String retValue = new String(out); + String retValue = new String(out, "UTF8"); // globalqss - [ 1577737 ] Security Breach - show database password // log.log (Level.ALL, value + " => " + retValue); return retValue;