@Test public void decryptSecretEngineNotFound() throws SecretDecryptionException { when(secretEngineRegistry.getEngine("does-not-exist")).thenReturn(null); String secretConfig = "encrypted:does-not-exist!paramName:paramValue"; exceptionRule.expect(SecretDecryptionException.class); exceptionRule.expectMessage("Secret Engine does not exist: does-not-exist"); secretManager.decrypt(secretConfig); }
public String decrypt(String configValue) { if (EncryptedSecret.isEncryptedSecret(configValue)) { return new String(decryptAsBytes(configValue)); } return configValue; }
SecretManager { public String decrypt(String configValue) { if (EncryptedSecret.isEncryptedSecret(configValue)) { return new String(decryptAsBytes(configValue)); } return configValue; } }
SecretManager { public String decrypt(String configValue) { if (EncryptedSecret.isEncryptedSecret(configValue)) { return new String(decryptAsBytes(configValue)); } return configValue; } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); }
SecretManager { public String decrypt(String configValue) { if (EncryptedSecret.isEncryptedSecret(configValue)) { return new String(decryptAsBytes(configValue)); } return configValue; } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); String decrypt(String configValue); Path decryptAsFile(String filePathOrEncrypted); byte[] decryptAsBytes(String encryptedString); }
SecretManager { public String decrypt(String configValue) { if (EncryptedSecret.isEncryptedSecret(configValue)) { return new String(decryptAsBytes(configValue)); } return configValue; } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); String decrypt(String configValue); Path decryptAsFile(String filePathOrEncrypted); byte[] decryptAsBytes(String encryptedString);  }