View Jitterbit Developer Portal
Page History
Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Introduction
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 Jitterbit.HMACSHA256.Signature
.
Global Variables
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.
Input
Name | Type | Required | Description | ||
---|---|---|---|---|---|
Jitterbit.HMACSHA256.Key | string | Required | The secret key. | ||
Jitterbit.HMACSHA256.Message | string | Required | The message for which to create a signature. | ||
Jitterbit.HMACSHA256.Encoding | string | Optional | The encoding to use when translating the key and message to bytes (e.g. "UTF-8" or "ISO-8859-1" ). If this value is not set, both the key and the message will be assumed to be US-ASCII. | ||
Jitterbit.HMACSHA256.Base64EncodedKey | boolean | Optional | Set to
| ||
Jitterbit.HMACSHA256.Base64EncodedMessage | boolean | Optional | Set to
|
Output
Name | Type | Description |
---|---|---|
Jitterbit.HMACSHA256.Signature | string | The variable returns the signature as a hex-encoded string. |
Example 1
This example script both sets the variables used as input for the HMAC-SHA256 Generator plugin, as well as runs the plugin.
Code Block |
---|
<trans> //Clear result: $Jitterbit.HMACSHA256.Signature = ""; $Jitterbit.HMACSHA256.Key = "dGVzdA=="; $Jitterbit.HMACSHA256.Message = "Test"; $Jitterbit.HMACSHA256.Encoding = "UTF-8"; // optional $Jitterbit.HMACSHA256.Base64EncodedKey = true; $Jitterbit.HMACSHA256.Base64EncodedMessage = false; eval(RunPlugin("<TAG>plugin:http://www.jitterbit.com/plugins/pipeline/user/HMACSHA256Generator</TAG>"), $error=GetLastError()); WriteToOperationLog("HMAC Signature: " + $Jitterbit.HMACSHA256.Signature); </trans> |
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.
Code Block | ||
---|---|---|
| ||
<trans> ArgumentList(key, message, encoding, keyEncoded, messageEncoded); encoding = IfEmpty(encoding, "UTF-8"); keyEncoded = IfEmpty(keyEncoded, False); messageEncoded = IfEmpty(messageEncoded, False); $Jitterbit.HMACSHA256.Key = key; $Jitterbit.HMACSHA256.Message = message; $Jitterbit.HMACSHA256.Encoding = encoding; $Jitterbit.HMACSHA256.Base64EncodedKey = keyEncoded; $Jitterbit.HMACSHA256.Base64EncodedMessage = messageEncoded; eval(RunPlugin("<TAG>plugin:http://www.jitterbit.com/plugins/pipeline/user/HMACSHA256Generator</TAG >"), $error=GetLastError()); $Jitterbit.HMACSHA256.Signature; </trans> |
Code Block | ||
---|---|---|
| ||
<trans> ArgumentList(key, dateStamp, regionName, serviceName, package); keySecret = ("AWS4" + key); keyDate = RunScript("<TAG>Scripts/Get HMAC-SHA256 Signature</TAG>", keySecret, dateStamp, "", False, False); keyRegion = RunScript("<TAG>Scripts/Get HMAC-SHA256 Signature</TAG>", Base64Encode(HexToBinary(keyDate)), regionName, "", True, False); keyService = RunScript("<TAG>Scripts/Get HMAC-SHA256 Signature</TAG>", Base64Encode(HexToBinary(keyRegion)), serviceName, "", True, False); keySigned = RunScript("<TAG>Scripts/Get HMAC-SHA256 Signature</TAG>", Base64Encode(HexToBinary(keyService)), package, "", True, False); </trans> |
Info |
---|
NOTE: The above script uses project item references in the Design Studio syntax. For syntax to use in Cloud Studio, see the RunScript() documentation. |
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Jitterbit Harmony
Jitterbit v5.x |
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
HideElements | ||
---|---|---|
|
Last updated: lastmodifieddate