cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/master to 9e3b825
Date Fri, 01 May 2015 06:20:33 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 58e5dca8e -> 9e3b825f9


findbugs: make default encoding explicit

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e3b825f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e3b825f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e3b825f

Branch: refs/heads/master
Commit: 9e3b825f9195a50c26dcd72807ae94797690d769
Parents: 58e5dca
Author: Daan Hoogland <dhoogland@schubergphilis.com>
Authored: Fri May 1 08:20:27 2015 +0200
Committer: Daan Hoogland <dhoogland@schubergphilis.com>
Committed: Fri May 1 08:20:27 2015 +0200

----------------------------------------------------------------------
 utils/src/com/cloud/utils/EncryptionUtil.java | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e3b825f/utils/src/com/cloud/utils/EncryptionUtil.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/EncryptionUtil.java b/utils/src/com/cloud/utils/EncryptionUtil.java
index e3ca4b0..e46bb9f 100644
--- a/utils/src/com/cloud/utils/EncryptionUtil.java
+++ b/utils/src/com/cloud/utils/EncryptionUtil.java
@@ -18,17 +18,20 @@
  */
 package com.cloud.utils;
 
-import com.cloud.utils.exception.CloudRuntimeException;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 import org.jasypt.encryption.pbe.PBEStringEncryptor;
 import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
 
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.io.UnsupportedEncodingException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 public class EncryptionUtil {
     public static final Logger s_logger = Logger.getLogger(EncryptionUtil.class.getName());
@@ -60,7 +63,7 @@ public class EncryptionUtil {
             final Mac mac = Mac.getInstance("HmacSHA1");
             final SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA1");
             mac.init(keySpec);
-            mac.update(data.getBytes());
+            mac.update(data.getBytes(Charset.defaultCharset()));
             final byte[] encryptedBytes = mac.doFinal();
             return Base64.encodeBase64String(encryptedBytes);
         } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException
e) {


Mime
View raw message