public class BootstrapFileCryptoKeyProvider extends Object implements CryptoKeyProvider
CryptoKeyProvider that loads the key from disk every time it is needed.
The persistence-backing of the key is in the bootstrap.conf file, which must be provided to the
constructor of this class.
As key access for sensitive value decryption is only used a few times during server initialization,
this implementation trades efficiency for security by only keeping the key in memory with an
in-scope reference for a brief period of time (assuming callers do not maintain an in-scope reference).CryptoKeyProvider| Modifier and Type | Field and Description |
|---|---|
private String |
bootstrapFile |
private static org.slf4j.Logger |
logger |
EMPTY_KEY| Constructor and Description |
|---|
BootstrapFileCryptoKeyProvider(String bootstrapFilePath)
Construct a new instance backed by the contents of a bootstrap.conf file.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getBootstrapFile() |
String |
getKey() |
String |
toString()
A string representation of this CryptoKeyProvider instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisEmptyprivate static final org.slf4j.Logger logger
private final String bootstrapFile
public BootstrapFileCryptoKeyProvider(String bootstrapFilePath)
bootstrapFilePath - The path to the bootstrap.conf file for this instance of NiFi Registry.
Must not be null.public String getBootstrapFile()
public String getKey() throws MissingCryptoKeyException
getKey in interface CryptoKeyProviderCryptoKeyProvider.EMPTY_KEY if the key is empty.MissingCryptoKeyException - if the key cannot be provided or determined for any reason.
If the key is known to be empty, CryptoKeyProvider.EMPTY_KEY will be returned and a
CryptoKeyMissingException will not be thrownpublic String toString()
CryptoKeyProvider
Note: Implementations of this interface should take care not to leak sensitive key material in any strings they emmit, including in the toString implementation.
toString in interface CryptoKeyProvidertoString in class ObjectCopyright © 2023 Apache NiFi Project. All rights reserved.