Wednesday, 19 December 2018

AWS4 Signature generation using LoadRunner

AWS4 Signature Generation steps

Steps for AWS4 signature generation is documented in detail here https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.htm

Here are the 4 steps at high level
Step1: Create a Canonical Request for Signature Version 4
Step2 : Create a String to Sign for Signature Version 4
Step 3: Calculate the Signature for AWS Signature Version 4
Step 4: Add the Signing Information to the Request

AWS4 Signature Generation using LoadRunner

AWS4 signature is generated using Javascript .

AWS4 Signature Generation steps

Steps for AWS4 signature generation is documented in detail here https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.htm

Here are the 4 steps at high level
Step1: Create a Canonical Request for Signature Version 4
Step2 : Create a String to Sign for Signature Version 4
Step 3: Calculate the Signature for AWS Signature Version 4
Step 4: Add the Signing Information to the Request

AWS4 Signature Generation using LoadRunner

AWS4 signature is generated using Javascript .















2. In awsSignature.js we have 4 functions defined.
  Function1: Generates required date and time stamps using below javascript function
     function unixts(){
              var now = new Date();
              var isoString = now.toISOString();
                  var newIsoString = now.toISOString().slice(0,19).replace(/-/g,"").replace(/:/g,"");
                  var finIsoString = newIsoString.concat("Z");
                  var DateStamp = now.toISOString().slice(0,10).replace(/-/g,"");
                  var values=[DateStamp,finIsoString];
                  return values;
              }
           Function2: Generates canonical request                                  
Function3: Generates string to sign
Function4: Generates AWS signature and returns  to the main C script along with other required values .
























Note: Also the below files are required for signature generation. These can be pulled from node.js libraries

3. Since values are returned as a string, they have to be sliced and the leading and trailing characters, spaces have to be removed.
Slicing is done using strtok and characters are removed using custom c function. Please refer the script for details.

4. Enable the below from RTS > Preferences in vugen, to execute the javascript code. 

2 comments:

  1. hi, i am looking for exactly the same.. can you help with these js files

    ReplyDelete
  2. Hi,
    Could you please inform me how to use correlated values of access key, secret key and session token in this code. baktha.vaka@gmail.com is my mail id

    ReplyDelete

How to create multiple client certificates and use them in JMeter script

Client authentication/ mutual authentication / Two-way SSL are typically implemented when the client device is expected to authenticate to ...