@Test public void decryptFileInvalidParams() throws SecretDecryptionException { doThrow(InvalidSecretFormatException.class).when(secretEngine).validate(any()); String secretConfig = "encrypted:s3!paramName:paramValue"; exceptionRule.expect(InvalidSecretFormatException.class); secretManager.decryptAsFile(secretConfig); }
public Path decryptAsFile(String filePathOrEncrypted) { if (!EncryptedSecret.isEncryptedSecret(filePathOrEncrypted)) { return Paths.get(filePathOrEncrypted); } else { return createTempFile("tmp", decryptAsBytes(filePathOrEncrypted)); } }
SecretManager { public Path decryptAsFile(String filePathOrEncrypted) { if (!EncryptedSecret.isEncryptedSecret(filePathOrEncrypted)) { return Paths.get(filePathOrEncrypted); } else { return createTempFile("tmp", decryptAsBytes(filePathOrEncrypted)); } } }
SecretManager { public Path decryptAsFile(String filePathOrEncrypted) { if (!EncryptedSecret.isEncryptedSecret(filePathOrEncrypted)) { return Paths.get(filePathOrEncrypted); } else { return createTempFile("tmp", decryptAsBytes(filePathOrEncrypted)); } } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); }
SecretManager { public Path decryptAsFile(String filePathOrEncrypted) { if (!EncryptedSecret.isEncryptedSecret(filePathOrEncrypted)) { return Paths.get(filePathOrEncrypted); } else { return createTempFile("tmp", decryptAsBytes(filePathOrEncrypted)); } } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); String decrypt(String configValue); Path decryptAsFile(String filePathOrEncrypted); byte[] decryptAsBytes(String encryptedString); }
SecretManager { public Path decryptAsFile(String filePathOrEncrypted) { if (!EncryptedSecret.isEncryptedSecret(filePathOrEncrypted)) { return Paths.get(filePathOrEncrypted); } else { return createTempFile("tmp", decryptAsBytes(filePathOrEncrypted)); } } @Autowired  SecretManager(SecretEngineRegistry secretEngineRegistry); String decrypt(String configValue); Path decryptAsFile(String filePathOrEncrypted); byte[] decryptAsBytes(String encryptedString);  }