@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"encryption","decryption","password","JCE","KDF","Argon2","Bcrypt","Scrypt","PBKDF2","salt","iv"}) @CapabilityDescription(value="Encrypts or Decrypts a FlowFile using either symmetric encryption with a raw key or password and randomly generated salt, or asymmetric encryption using a public and secret key.") @SystemResourceConsideration(resource=CPU) @WritesAttribute(attribute="encryptcontent.action",description="\"encrypted\" or \"decrypted\" depending on the processor action") @WritesAttribute(attribute="encryptcontent.algorithm",description="The algorithm used for the cryptographic operation") @WritesAttribute(attribute="encryptcontent.cipher_text_length",description="The cipher text length in bytes (including IV, salt, and delimiters if present). Determined from incoming content in decrypt mode; outgoing content in encrypt mode") @WritesAttribute(attribute="encryptcontent.iv",description="The Initialization Vector in hex encoding (if present)") @WritesAttribute(attribute="encryptcontent.iv_length",description="The IV length in bytes") @WritesAttribute(attribute="encryptcontent.kdf",description="The Key Derivation Function used if Password-Based Encryption was enabled. See Admin Guide - Key Derivation Functions") @WritesAttribute(attribute="encryptcontent.kdf_salt",description="The KDF-specific salt including algorithm and cost parameters (if present). See Admin Guide - Key Derivation Functions") @WritesAttribute(attribute="encryptcontent.kdf_salt_length",description="The KDF salt length in bytes") @WritesAttribute(attribute="encryptcontent.pbkdf2_iterations",description="The number of iterations used in PBKDF2 KDF (if present). PBKDF2 does not encode the cost parameter in a custom salt") @WritesAttribute(attribute="encryptcontent.plaintext_length",description="The plaintext length in bytes. Determined from incoming content in encrypt mode; outgoing content in decrypt mode") @WritesAttribute(attribute="encryptcontent.salt",description="The raw salt in hex encoding (if present)") @WritesAttribute(attribute="encryptcontent.salt_length",description="The raw salt length in bytes") @WritesAttribute(attribute="encryptcontent.timestamp",description="The timestamp at which the cryptographic operation occurred in \'yyyy-MM-dd HH:mm:ss.SSS Z\' format") public class EncryptContent extends AbstractProcessor
| Modifier and Type | Class and Description |
|---|---|
static interface |
EncryptContent.Encryptor |
| Constructor and Description |
|---|
EncryptContent() |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final String ENCRYPT_MODE
public static final String DECRYPT_MODE
private static final String WEAK_CRYPTO_ALLOWED_NAME
private static final String WEAK_CRYPTO_NOT_ALLOWED_NAME
public static final String IV_ATTR
public static final String IV_LEN_ATTR
public static final String SALT_ATTR
public static final String SALT_LEN_ATTR
public static final String KDF_SALT_ATTR
public static final String KDF_SALT_LEN_ATTR
public static final String PT_LEN_ATTR
public static final String CT_LEN_ATTR
public static final String TS_ATTR
public static final String ACTION_ATTR
public static final String ALGORITHM_ATTR
public static final String KDF_ATTR
public static final PropertyDescriptor MODE
public static final PropertyDescriptor KEY_DERIVATION_FUNCTION
public static final PropertyDescriptor ENCRYPTION_ALGORITHM
public static final PropertyDescriptor PASSWORD
public static final PropertyDescriptor PUBLIC_KEYRING
public static final PropertyDescriptor PUBLIC_KEY_USERID
public static final PropertyDescriptor PRIVATE_KEYRING
public static final PropertyDescriptor PRIVATE_KEYRING_PASSPHRASE
public static final PropertyDescriptor PGP_SYMMETRIC_ENCRYPTION_CIPHER
public static final PropertyDescriptor RAW_KEY_HEX
public static final PropertyDescriptor ALLOW_WEAK_CRYPTO
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private static final DeprecationLogger deprecationLogger
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private static AllowableValue[] buildKeyDerivationFunctionAllowableValues()
private static AllowableValue[] buildEncryptionMethodAllowableValues()
private static AllowableValue[] buildWeakCryptoAllowableValues()
private static AllowableValue buildDefaultWeakCryptoAllowableValue()
private static AllowableValue[] buildPGPSymmetricCipherAllowableValues()
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic static boolean isPGPAlgorithm(String algorithm)
public static boolean isPGPArmoredAlgorithm(String algorithm)
protected Collection<ValidationResult> customValidate(ValidationContext context)
customValidate in class AbstractConfigurableComponentprivate static boolean isValidCipher(int cipher)
cipher as contained in the PGP_SYMMETRIC_ENCRYPTION_CIPHER.cipher - an integer indicating a particular cipherprivate List<ValidationResult> validatePGP(EncryptionMethod encryptionMethod, String password, boolean encrypt, String publicKeyring, String publicUserId, String privateKeyring, String privateKeyringPassphrase, int cipher)
private List<ValidationResult> validatePBE(EncryptionMethod encryptionMethod, KeyDerivationFunction kdf, String password, boolean allowWeakCrypto)
private List<ValidationResult> validatePassword(EncryptionMethod encryptionMethod, KeyDerivationFunction kdf, String password, boolean allowWeakCrypto)
private List<ValidationResult> validateKeyed(EncryptionMethod encryptionMethod, KeyDerivationFunction kdf, String keyHex, String password, boolean allowWeakCrypto, boolean encrypt)
private void validateKeyHex(EncryptionMethod encryptionMethod, String keyHex, List<ValidationResult> validationResults, int allowedKeyLength)
private List<String> getKDFsForPBECipher(EncryptionMethod encryptionMethod)
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger in class AbstractProcessorprivate EncryptContent.Encryptor createPGPEncryptor(ProcessContext context, FlowFile flowFile, String providerName, String algorithm, Integer pgpCipher, String password, boolean encrypt)
private EncryptContent.Encryptor createKeyedEncryptor(ProcessContext context, EncryptionMethod encryptionMethod) throws org.apache.commons.codec.DecoderException
org.apache.commons.codec.DecoderExceptionprivate EncryptContent.Encryptor createPBEEncryptor(EncryptionMethod encryptionMethod, String password, KeyDerivationFunction kdf)
Copyright © 2023 Apache NiFi Project. All rights reserved.