Overview of Aes_enc() Functionality
The Aes_enc() function in FortiADC is a pivotal tool for encrypting data, ensuring that sensitive information remains secure and protected. By leveraging the AES (Advanced Encryption Standard) key-based encryption methodology, users can effectively manage the encryption process through scripting within FortiADC systems.
Understanding the Aes_enc() Syntax and Usage
The function Aes_enc(t); requires a thorough understanding of its syntax and the specific parameters it engages with. Below is the breakdown:
- t: A table that outlines the core components for encryption, which include the message, the encryption key, and the key size. This syntax is uncomplicated yet critical for establishing a secure encryption protocol.
How to Configure Aes_enc() for Data Encryption
To effectively employ Aes_enc() in your encryption activities, you’ll need to set up a table with the required arguments. Here’s a step-by-step guide:
- First, initiate a table t to store your encryption details.
- Assign your message to t[“message”] = “YourMessage”.
- Define the encryption key with t[“key”] = “Your16CharKey”. Note that the key must be either 16, 24, or 32 characters long, depending on the encryption size.
- Set the desired key size: 128, 192, or 256 bits as follows: t[“size”] = 128. Each size corresponds directly to key lengths of 16, 24, and 32 characters respectively.
With these configurations, your data is primed for encryption. Execute the encryption by running:
enc = aes_enc(t)
This command utilizes the parameters within table t to produce an encrypted output.
Example of Aes_enc() in Action
Consider the following usage example where data is encrypted upon an HTTP_REQUEST event:
when HTTP_REQUEST {
t={};
t[“message”] = “MICK-TEST”;
t[“key”] = “aaaaaaaaaabbbbbb”;
t[“size”] = 128;
enc = aes_enc(t);
debug(“The aes_enc output to HEXn %sn”,to_HEX(enc));
}
In this example, the message MICK-TEST is securely encrypted using a 16-character key.
Key Considerations
- Message: Ensure your message is accurately inputted as a string.
- Key: Verify that your encryption key adheres to the correct length based on selected key size.
- Size: This must be 128, 192, or 256 bits, aligning with your intended security level.
The Aes_enc() function is supported in FortiADC version 5.2.x and later, making it accessible to a wide range of users seeking robust data security solutions.