public class RepositoryObjectAESCTREncryptor extends AbstractAESEncryptor implements RepositoryObjectStreamEncryptor
RepositoryObjectStreamEncryptor handles streaming data by accepting
OutputStream and InputStream parameters and returning custom implementations which wrap the normal
behavior with encryption/decryption logic transparently. This class should be used when a repository needs to persist
and retrieve streaming data (i.e. content claims). For repositories handling limited blocks of data with the length
known a priori (i.e. provenance records or flowfile attribute maps), use the
RepositoryObjectAESGCMEncryptor which will provide
authenticated encryption.| Modifier and Type | Field and Description |
|---|---|
private static String |
ALGORITHM |
private static byte[] |
EM_START_SENTINEL |
private static org.slf4j.Logger |
logger |
private static List<String> |
SUPPORTED_VERSIONS |
private static String |
VERSION |
aesKeyedCipherProvider, EMPTY_IV, IV_LENGTH, keyProvider| Constructor and Description |
|---|
RepositoryObjectAESCTREncryptor() |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
decrypt(InputStream encryptedInputStream,
String streamId)
Returns an
InputStream which decrypts the content of the provided InputStream. |
OutputStream |
encrypt(OutputStream plainStream,
String streamId,
String keyId)
Returns an
OutputStream which encrypts the content of the provided OutputStream. |
String |
getNextKeyId()
Returns a valid key identifier for this encryptor (valid for encryption and decryption) or throws an exception if none are available.
|
initialize, prepareObjectForDecryptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeprivate static final org.slf4j.Logger logger
private static final byte[] EM_START_SENTINEL
private static String ALGORITHM
private static final String VERSION
public OutputStream encrypt(OutputStream plainStream, String streamId, String keyId) throws EncryptionException
OutputStream which encrypts the content of the provided OutputStream. This method works on
streams to allow for streaming data rather than blocks of bytes of a known length. It is recommended to use this
for data like flowfile content claims, rather than provenance records or flowfile attribute maps.encrypt in interface RepositoryObjectStreamEncryptorplainStream - the plain OutputStream which is being written tostreamId - an identifier for this stream (eventId, generated, etc.)keyId - the ID of the key to useRepositoryObjectEncryptionMetadataEncryptionException - if there is an issue encrypting this streaming repository objectpublic InputStream decrypt(InputStream encryptedInputStream, String streamId) throws EncryptionException
InputStream which decrypts the content of the provided InputStream. The provided InputStream
must contain a valid RepositoryObjectEncryptionMetadata object at the start of the stream. This method
works on streams to allow for streaming data rather than blocks of bytes of a known length. It is recommended to
use this for data like flowfile content claims, rather than provenance records or flowfile attribute maps.decrypt in interface RepositoryObjectStreamEncryptorencryptedInputStream - the encrypted InputStream (starting with the plaintext ROEM) which is being read fromstreamId - an identifier for this stream (eventId, generated, etc.)RepositoryObjectEncryptionMetadataEncryptionException - if there is an issue decrypting this streaming repository objectpublic String getNextKeyId() throws KeyManagementException
getNextKeyId in interface RepositoryObjectStreamEncryptorKeyManagementException - if no available key IDs are valid for both operationsCopyright © 2020 Apache NiFi Project. All rights reserved.