Source:
<code>protected void updateOverlordProperties() throws Exception { String filePath = getOverlordPropertiesFilePath(); File overlordFile = new File(filePath); if (overlordFile.exists()) { FileInputStream in = null; try { in = new FileInputStream(filePath); Properties props = new Properties(); props.load(in); FileOutputStream out = null; try { out = new FileOutputStream(filePath); if (!props.containsKey(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE)) { props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE, CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE_VALUE); } if (!props.containsKey(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS)) { props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS, CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS_VALUE); } <START> String encryptedPassword = "${crypt:" + AesEncrypter.encrypt(keystorePassword) + "}"; <END> props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_ALIAS_PASSWORD_KEY, encryptedPassword); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_PASSWORD_KEY, encryptedPassword); props.store(out, null); } finally { out.close(); } } finally { in.close(); } } else { boolean created = overlordFile.createNewFile(); if (created) { Properties props = new Properties(); FileOutputStream out = null; try { out = new FileOutputStream(filePath); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE, CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE_VALUE); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS, CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS_VALUE); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_ALIAS_PASSWORD_KEY, keystorePassword); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_PASSWORD_KEY, keystorePassword); props.store(out, null); } finally { out.close(); } } } }</code><technical_language>good point here. I forgot encrypt password</technical_language>

Target:
protected void updateOverlordProperties() throws Exception { String filePath = getOverlordPropertiesFilePath(); File overlordFile = new File(filePath); String encryptedPassword = "${crypt:" + AesEncrypter.encrypt(keystorePassword) + "}"; if (overlordFile.exists()) { FileInputStream in = null; try { in = new FileInputStream(filePath); Properties props = new Properties(); props.load(in); FileOutputStream out = null; try { out = new FileOutputStream(filePath); if (!props.containsKey(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE)) { props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE, CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE_VALUE); } if (!props.containsKey(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS)) { props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS, CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS_VALUE); } props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_ALIAS_PASSWORD_KEY, encryptedPassword); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_PASSWORD_KEY, encryptedPassword); props.store(out, null); } finally { out.close(); } } finally { in.close(); } } else { boolean created = overlordFile.createNewFile(); if (created) { Properties props = new Properties(); FileOutputStream out = null; try { out = new FileOutputStream(filePath); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE, CommandConstants.OverlordProperties.OVERLORD_SAML_KEYSTORE_VALUE); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS, CommandConstants.OverlordProperties.OVERLORD_SAML_ALIAS_VALUE); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_ALIAS_PASSWORD_KEY, encryptedPassword); props.setProperty(CommandConstants.OverlordProperties.OVERLORD_KEYSTORE_PASSWORD_KEY, encryptedPassword); props.store(out, null); } finally { out.close(); } } } }