}
}
private boolean migrateProperties(File dbPropsFile, Properties dbProps, String newMSKey, String newDBKey) {
System.out.println("Migrating db.properties..");
StandardPBEStringEncryptor msEncryptor = new StandardPBEStringEncryptor();
;
initEncryptor(msEncryptor, newMSKey);
try {
PropertiesConfiguration newDBProps = new PropertiesConfiguration(dbPropsFile);
if (newDBKey != null && !newDBKey.isEmpty()) {
newDBProps.setProperty("db.cloud.encrypt.secret", "ENC(" + msEncryptor.encrypt(newDBKey) + ")");
}
String prop = dbProps.getProperty("db.cloud.password");
if (prop != null && !prop.isEmpty()) {
newDBProps.setProperty("db.cloud.password", "ENC(" + msEncryptor.encrypt(prop) + ")");
}
prop = dbProps.getProperty("db.usage.password");
if (prop != null && !prop.isEmpty()) {
newDBProps.setProperty("db.usage.password", "ENC(" + msEncryptor.encrypt(prop) + ")");
}
newDBProps.save(dbPropsFile.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
return false;