@Test public void encryptionIsNotUsedWhenSavingToVault() { final ArgonOptions argonOptions = mock(ArgonOptions.class); awsSecretManagerKeyGenerator.generate("vaultId", argonOptions, null); verifyNoMoreInteractions(argonOptions); }
@Override public AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions) { final KeyPair keys = this.encryptor.generateNewKeys(); final StringBuilder publicId = new StringBuilder(); final StringBuilder privateId = new StringBuilder(); if (filename != null) { final Path path = Paths.get(filename); final String secretId = path.getFileName().toString(); if (!secretId.matches("^[0-9a-zA-Z\\-/_+=.@]*$")) { throw new UnsupportedCharsetException( "Generated key ID for AWS Secret Manager can contain only 0-9, a-z, A-Z and /_+=.@- characters"); } publicId.append(secretId); privateId.append(secretId); } publicId.append("Pub"); privateId.append("Key"); saveKeyInSecretManager(publicId.toString(), keys.getPublicKey()); saveKeyInSecretManager(privateId.toString(), keys.getPrivateKey()); return new AWSKeyPair(publicId.toString(), privateId.toString()); }
AWSSecretManagerKeyGenerator implements KeyGenerator { @Override public AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions) { final KeyPair keys = this.encryptor.generateNewKeys(); final StringBuilder publicId = new StringBuilder(); final StringBuilder privateId = new StringBuilder(); if (filename != null) { final Path path = Paths.get(filename); final String secretId = path.getFileName().toString(); if (!secretId.matches("^[0-9a-zA-Z\\-/_+=.@]*$")) { throw new UnsupportedCharsetException( "Generated key ID for AWS Secret Manager can contain only 0-9, a-z, A-Z and /_+=.@- characters"); } publicId.append(secretId); privateId.append(secretId); } publicId.append("Pub"); privateId.append("Key"); saveKeyInSecretManager(publicId.toString(), keys.getPublicKey()); saveKeyInSecretManager(privateId.toString(), keys.getPrivateKey()); return new AWSKeyPair(publicId.toString(), privateId.toString()); } }
AWSSecretManagerKeyGenerator implements KeyGenerator { @Override public AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions) { final KeyPair keys = this.encryptor.generateNewKeys(); final StringBuilder publicId = new StringBuilder(); final StringBuilder privateId = new StringBuilder(); if (filename != null) { final Path path = Paths.get(filename); final String secretId = path.getFileName().toString(); if (!secretId.matches("^[0-9a-zA-Z\\-/_+=.@]*$")) { throw new UnsupportedCharsetException( "Generated key ID for AWS Secret Manager can contain only 0-9, a-z, A-Z and /_+=.@- characters"); } publicId.append(secretId); privateId.append(secretId); } publicId.append("Pub"); privateId.append("Key"); saveKeyInSecretManager(publicId.toString(), keys.getPublicKey()); saveKeyInSecretManager(privateId.toString(), keys.getPrivateKey()); return new AWSKeyPair(publicId.toString(), privateId.toString()); } AWSSecretManagerKeyGenerator(
            Encryptor encryptor, KeyVaultService<AWSSetSecretData, AWSGetSecretData> keyVaultService); }
AWSSecretManagerKeyGenerator implements KeyGenerator { @Override public AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions) { final KeyPair keys = this.encryptor.generateNewKeys(); final StringBuilder publicId = new StringBuilder(); final StringBuilder privateId = new StringBuilder(); if (filename != null) { final Path path = Paths.get(filename); final String secretId = path.getFileName().toString(); if (!secretId.matches("^[0-9a-zA-Z\\-/_+=.@]*$")) { throw new UnsupportedCharsetException( "Generated key ID for AWS Secret Manager can contain only 0-9, a-z, A-Z and /_+=.@- characters"); } publicId.append(secretId); privateId.append(secretId); } publicId.append("Pub"); privateId.append("Key"); saveKeyInSecretManager(publicId.toString(), keys.getPublicKey()); saveKeyInSecretManager(privateId.toString(), keys.getPrivateKey()); return new AWSKeyPair(publicId.toString(), privateId.toString()); } AWSSecretManagerKeyGenerator(
            Encryptor encryptor, KeyVaultService<AWSSetSecretData, AWSGetSecretData> keyVaultService); @Override AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions); }
AWSSecretManagerKeyGenerator implements KeyGenerator { @Override public AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions) { final KeyPair keys = this.encryptor.generateNewKeys(); final StringBuilder publicId = new StringBuilder(); final StringBuilder privateId = new StringBuilder(); if (filename != null) { final Path path = Paths.get(filename); final String secretId = path.getFileName().toString(); if (!secretId.matches("^[0-9a-zA-Z\\-/_+=.@]*$")) { throw new UnsupportedCharsetException( "Generated key ID for AWS Secret Manager can contain only 0-9, a-z, A-Z and /_+=.@- characters"); } publicId.append(secretId); privateId.append(secretId); } publicId.append("Pub"); privateId.append("Key"); saveKeyInSecretManager(publicId.toString(), keys.getPublicKey()); saveKeyInSecretManager(privateId.toString(), keys.getPrivateKey()); return new AWSKeyPair(publicId.toString(), privateId.toString()); } AWSSecretManagerKeyGenerator(
            Encryptor encryptor, KeyVaultService<AWSSetSecretData, AWSGetSecretData> keyVaultService); @Override AWSKeyPair generate(String filename, ArgonOptions encryptionOptions, KeyVaultOptions keyVaultOptions);  }