Crypto Encrypt Action
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Encrypts the body of each message with a secret key, such as an AES key, for crypto-decrypt-action to decrypt later with the same key.
Use it to protect sensitive data, such as personal or payment details, before it is stored or sent through a system you do not fully trust, and decrypt it later with crypto-decrypt-action and the same algorithm and key.
Input: text or bytes.
Output: the body is the encrypted data, as bytes (a stream), a little longer than the input. It is not text: to send it where only text fits, encode it, for example in Base64. The headers are kept.
Good to know: the key is a secret; anyone who has it can decrypt the data, so keep it in a vault or a secret, not in plain configuration. The encrypted data carries a check value, so crypto-decrypt-action fails on data that was changed or decrypted with another key. A key of the wrong length fails each message, not the start. Set mode to CBC: without it, AES encrypts in ECB mode, where equal parts of the data give equal encrypted bytes. Data encrypted without mode is decrypted only without mode, so set it on both actions at the same time.
Configuration Options
The following table summarizes the configuration options available for the crypto-encrypt-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Algorithm | Required The name of the encryption algorithm, such as | string | AES | ||
Secret Key | Required The secret key, as text. Its length must fit the algorithm: for | string | |||
Mode | The block cipher mode, | string | CBC |
Dependencies
At runtime, the crypto-encrypt-action Kamelet relies upon the presence of the following dependencies:
-
camel:kamelet
-
camel:crypto
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:crypto-encrypt-action"
parameters:
.
.
.
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml