CLOUDSTACK-6239: Encrypt security related config values before inserting into DB

This commit is contained in:
Kishan Kavala 2014-03-28 18:47:05 +05:30 committed by Kishan Kavala
parent fe4e4858ce
commit b8ddbe8ffa
1 changed files with 5 additions and 3 deletions

View File

@ -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();
}