Repository: cloudstack Updated Branches: refs/heads/4.4 89c6f0087 -> 45ab288e2
CLOUDSTACK-6239: Encrypt security related config values before inserting into DB Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/45ab288e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/45ab288e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/45ab288e Branch: refs/heads/4.4 Commit: 45ab288e26865f3777230000452c119d4f0835e2 Parents: 89c6f00 Author: Kishan Kavala <[email protected]> Authored: Fri Mar 28 18:47:05 2014 +0530 Committer: Kishan Kavala <[email protected]> Committed: Fri Mar 28 18:47:21 2014 +0530 ---------------------------------------------------------------------- .../cloudstack/framework/security/keys/KeysManagerImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45ab288e/framework/security/src/org/apache/cloudstack/framework/security/keys/KeysManagerImpl.java ---------------------------------------------------------------------- diff --git a/framework/security/src/org/apache/cloudstack/framework/security/keys/KeysManagerImpl.java b/framework/security/src/org/apache/cloudstack/framework/security/keys/KeysManagerImpl.java index 550bd15..15bb49c 100644 --- a/framework/security/src/org/apache/cloudstack/framework/security/keys/KeysManagerImpl.java +++ b/framework/security/src/org/apache/cloudstack/framework/security/keys/KeysManagerImpl.java @@ -61,7 +61,7 @@ public class KeysManagerImpl implements KeysManager, Configurable { public String getHashKey() { String value = HashKey.value(); if (value == null) { - _configDepot.set(HashKey, getBase64EncodedRandomKey(128)); + _configDao.getValueAndInitIfNotExist(HashKey.key(), HashKey.category(), getBase64EncodedRandomKey(128), HashKey.description()); } return HashKey.value(); @@ -71,7 +71,8 @@ public class KeysManagerImpl implements KeysManager, Configurable { public String getEncryptionKey() { String value = EncryptionKey.value(); if (value == null) { - _configDepot.set(EncryptionKey, getBase64EncodedRandomKey(128)); + _configDao.getValueAndInitIfNotExist(EncryptionKey.key(), EncryptionKey.category(), getBase64EncodedRandomKey(128), + EncryptionKey.description()); } return EncryptionKey.value(); } @@ -80,7 +81,8 @@ public class KeysManagerImpl implements KeysManager, Configurable { public String getEncryptionIV() { String value = EncryptionIV.value(); if (value == null) { - _configDepot.set(EncryptionIV, getBase64EncodedRandomKey(128)); + _configDao.getValueAndInitIfNotExist(EncryptionIV.key(), EncryptionIV.category(), getBase64EncodedRandomKey(128), + EncryptionIV.description()); } return EncryptionIV.value(); }
