public class RepositoryObjectAESGCMEncryptor extends AbstractAESEncryptor implements RepositoryObjectBlockEncryptor
RepositoryObjectBlockEncryptor handles block data by accepting
byte[] parameters and returning byte[] which contain the encrypted/decrypted content. This class
should be used when a repository needs to persist and retrieve block data with the length known a priori (i.e.
provenance records or flowfile attribute maps). For repositories handling streams of data with unknown or large
lengths (i.e. content claims), use the
RepositoryObjectAESCTREncryptor which does not provide
authenticated encryption but performs much better with large data.| Modifier and Type | Field and Description |
|---|---|
private static String |
ALGORITHM |
private static org.slf4j.Logger |
logger |
private static int |
METADATA_DEFAULT_LENGTH |
private static int |
MIN_METADATA_LENGTH |
private static byte[] |
SENTINEL |
private static List<String> |
SUPPORTED_VERSIONS |
private static String |
VERSION |
aesKeyedCipherProvider, EMPTY_IV, IV_LENGTH, keyProvider| Constructor and Description |
|---|
RepositoryObjectAESGCMEncryptor() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] encryptedRecord,
String recordId)
Decrypts the provided byte[] (an encrypted record with accompanying metadata).
|
byte[] |
encrypt(byte[] plainRecord,
String recordId,
String keyId)
Encrypts the serialized byte[].
|
private byte[] |
extractCipherBytes(byte[] encryptedRecord,
RepositoryObjectEncryptionMetadata metadata) |
String |
getNextKeyId()
Returns a valid key identifier for this encryptor (valid for encryption and decryption) or throws an exception if none are available.
|
String |
toString() |
initialize, prepareObjectForDecryptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitializeprivate static final org.slf4j.Logger logger
private static final String ALGORITHM
private static final String VERSION
private static final int MIN_METADATA_LENGTH
private static final int METADATA_DEFAULT_LENGTH
private static final byte[] SENTINEL
public byte[] encrypt(byte[] plainRecord,
String recordId,
String keyId)
throws EncryptionException
encrypt in interface RepositoryObjectBlockEncryptorplainRecord - the plain record, serialized to a byte[]recordId - an identifier for this record (eventId, generated, etc.)keyId - the ID of the key to useEncryptionException - if there is an issue encrypting this recordpublic byte[] decrypt(byte[] encryptedRecord,
String recordId)
throws EncryptionException
decrypt in interface RepositoryObjectBlockEncryptorencryptedRecord - the encrypted record in byte[] formrecordId - an identifier for this record (eventId, generated, etc.)EncryptionException - if there is an issue decrypting this recordpublic String getNextKeyId() throws KeyManagementException
getNextKeyId in interface RepositoryObjectBlockEncryptorKeyManagementException - if no available key IDs are valid for both operationsprivate byte[] extractCipherBytes(byte[] encryptedRecord,
RepositoryObjectEncryptionMetadata metadata)
Copyright © 2019 Apache NiFi Project. All rights reserved.