The HMAC-SHA256 Generator plugin is used to generate a message signature using the SHA-256 hash function. The signature is returned as a hex-encoded string in the output variable
To use this plugin, any required global variables must be set in a script for use with the plugin. The input table below documents all possible variables for this plugin. The output table documents the signature variable output by the plugin.
|string||Required||The secret key.|
|string||Required||The message for which to create a signature.|
|string||Optional||The encoding to use when translating the key and message to bytes (e.g. |
NOTE: This variable is available only in version 126.96.36.199 or higher of this plugin.
NOTE: This variable is available only in version 188.8.131.52 or higher of this plugin.
|string||The variable returns the signature as a hex-encoded string.|
This example script both sets the variables used as input for the HMAC-SHA256 Generator plugin, as well as runs the plugin.
The result of running this script is
HMAC Signature: 52d7189b38b924d7ff81e70f1825993363df5bac2ffb2a03c73a0dbb4638759d.
Example 2 (AWS)
This example uses scripting to authenticate with the AWS REST API using AWS Signature Version 4. The first script sets the variables used as input for the HMAC-SHA256 Generator plugin and runs the plugin. The second script is for getting the AWS Signature using the first script.
Examples of the values you need to pass to AWS Signature Version 4 can be found in the AWS documentation Authenticating Requests (AWS Signature Version 4). For additional assistance, please contact support.