public class VaultBytesKeyGenerator extends Object implements BytesKeyGenerator
transit
backend to generate high-quality
random bytes of the configured length.
Using Vault ensures to use a high-entropy source preventing to consume entropy of the local machine.
Constructor and Description |
---|
VaultBytesKeyGenerator(VaultOperations vaultOperations)
Creates a new
VaultBytesKeyGenerator initialized to generate 32
random bytes using transit for transit mount path. |
VaultBytesKeyGenerator(VaultOperations vaultOperations,
String transitPath,
int length)
Creates a new
VaultBytesKeyGenerator initialized to generate length
random bytes. |
Modifier and Type | Method and Description |
---|---|
byte[] |
generateKey() |
int |
getKeyLength() |
public VaultBytesKeyGenerator(VaultOperations vaultOperations)
VaultBytesKeyGenerator
initialized to generate 32
random bytes using transit
for transit mount path.vaultOperations
- must not be null.public VaultBytesKeyGenerator(VaultOperations vaultOperations, String transitPath, int length)
VaultBytesKeyGenerator
initialized to generate length
random bytes.vaultOperations
- must not be null.transitPath
- path of the transit backend, must not be null or
empty.length
- number of random bytes to generate. Must be greater than zero.public int getKeyLength()
getKeyLength
in interface BytesKeyGenerator
public byte[] generateKey()
generateKey
in interface BytesKeyGenerator
Copyright © 2016–2019 Pivotal Software, Inc.. All rights reserved.