@Test public void testUnMarshallWithUserInputSecret() { envVariables.clear(com.quorum.tessera.config.util.EnvironmentVariables.CONFIG_SECRET_PATH); resolver = new EncryptedStringResolver(); ByteArrayInputStream in = new ByteArrayInputStream(("quorum" + System.lineSeparator() + "quorum").getBytes()); System.setIn(in); assertThat(resolver.resolve("ENC(KLa6pRQpxI8Ez3Bo6D3cI6y13YYdntu7)")).isEqualTo("password"); System.setIn(System.in); }
public String resolve(final String textToDecrypt) { if (PropertyValueEncryptionUtils.isEncryptedValue(textToDecrypt)) { if (!isPasswordSet) { encryptor.setPasswordCharArray( ConfigSecretReader.readSecretFromFile().orElseGet(ConfigSecretReader::readSecretFromConsole)); isPasswordSet = true; } return PropertyValueEncryptionUtils.decrypt(textToDecrypt, encryptor); } LOGGER.warn( "Some sensitive values are being given as unencrypted plain text in config. " + "Please note this is NOT recommended for production environment."); return textToDecrypt; }
EncryptedStringResolver { public String resolve(final String textToDecrypt) { if (PropertyValueEncryptionUtils.isEncryptedValue(textToDecrypt)) { if (!isPasswordSet) { encryptor.setPasswordCharArray( ConfigSecretReader.readSecretFromFile().orElseGet(ConfigSecretReader::readSecretFromConsole)); isPasswordSet = true; } return PropertyValueEncryptionUtils.decrypt(textToDecrypt, encryptor); } LOGGER.warn( "Some sensitive values are being given as unencrypted plain text in config. " + "Please note this is NOT recommended for production environment."); return textToDecrypt; } }
EncryptedStringResolver { public String resolve(final String textToDecrypt) { if (PropertyValueEncryptionUtils.isEncryptedValue(textToDecrypt)) { if (!isPasswordSet) { encryptor.setPasswordCharArray( ConfigSecretReader.readSecretFromFile().orElseGet(ConfigSecretReader::readSecretFromConsole)); isPasswordSet = true; } return PropertyValueEncryptionUtils.decrypt(textToDecrypt, encryptor); } LOGGER.warn( "Some sensitive values are being given as unencrypted plain text in config. " + "Please note this is NOT recommended for production environment."); return textToDecrypt; } EncryptedStringResolver(); }
EncryptedStringResolver { public String resolve(final String textToDecrypt) { if (PropertyValueEncryptionUtils.isEncryptedValue(textToDecrypt)) { if (!isPasswordSet) { encryptor.setPasswordCharArray( ConfigSecretReader.readSecretFromFile().orElseGet(ConfigSecretReader::readSecretFromConsole)); isPasswordSet = true; } return PropertyValueEncryptionUtils.decrypt(textToDecrypt, encryptor); } LOGGER.warn( "Some sensitive values are being given as unencrypted plain text in config. " + "Please note this is NOT recommended for production environment."); return textToDecrypt; } EncryptedStringResolver(); String resolve(final String textToDecrypt); }
EncryptedStringResolver { public String resolve(final String textToDecrypt) { if (PropertyValueEncryptionUtils.isEncryptedValue(textToDecrypt)) { if (!isPasswordSet) { encryptor.setPasswordCharArray( ConfigSecretReader.readSecretFromFile().orElseGet(ConfigSecretReader::readSecretFromConsole)); isPasswordSet = true; } return PropertyValueEncryptionUtils.decrypt(textToDecrypt, encryptor); } LOGGER.warn( "Some sensitive values are being given as unencrypted plain text in config. " + "Please note this is NOT recommended for production environment."); return textToDecrypt; } EncryptedStringResolver(); String resolve(final String textToDecrypt);  }