cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Help (hmac sha512)

Please advice

 

While determining the SHA512 value using the 30 form field values and that is returned from the silent url doesn't match

 

StringValue = "^^60117720851^false^1^H0ENJ3^P^2^Y^CC^XXXX0002^5.00^^Kim^Abunuwara^test, ,^Orem^UT^84097^United States of America^^^gartha@quickmerlin.com^^^^^^^^^1111651-MS-903088832^  "

Signature Key = DC3F79CD0C200E088B3E51EA84BFDC47EED00388F46C014C794D95BF499467EC31FA42AD7AEAFBEE88D9888CE777EF428D3B2C18915DAC2660CA3204A1C53AAB

 

Actual Value from Response

SHA512 = 1B63276C9779170B4C74B261FD742C26939420C2FBFE714410A38B11CB1E9B5972AD37B5ECBC6778CAA388BD89B5D567557C0527CECF4B67482BF2F2CC787444 get from the response

 

Scenario 1

By using the string Value (30 form field values) and by using the .net Code to determine the SHA512 i get a different value

Following is how i determine the textToHash value

 

Dim x_trans_id
    x_trans_id = AssignDefaultValueIfBlank(Request.Form("x_trans_id"))
Dim x_test_request
    x_test_request = AssignDefaultValueIfBlank(Request.Form("x_test_request"))
Dim x_response_code
    x_response_code = AssignDefaultValueIfBlank(Request.Form("x_response_code"))
Dim x_auth_code
    x_auth_code = AssignDefaultValueIfBlank(Request.Form("x_auth_code"))
Dim x_cvv2_resp_code
    x_cvv2_resp_code = AssignDefaultValueIfBlank(Request.Form("x_cvv2_resp_code"))
Dim x_cavv_response
    x_cavv_response = AssignDefaultValueIfBlank(Request.Form("x_cavv_response"))     
Dim x_avs_code
    x_avs_code = AssignDefaultValueIfBlank(Request.Form("x_avs_code"))     
Dim x_method
    x_method = AssignDefaultValueIfBlank(Request.Form("x_method"))
Dim x_account_number
    x_account_number = AssignDefaultValueIfBlank(Request.Form("x_account_number"))   
Dim x_amount
    x_amount = AssignDefaultValueIfBlank(Request.Form("x_amount"))     
Dim x_company
    x_company = AssignDefaultValueIfBlank(Request.Form("x_company"))     
Dim x_first_name
    x_first_name = AssignDefaultValueIfBlank(Request.Form("x_first_name"))   
Dim x_last_name
    x_last_name = AssignDefaultValueIfBlank(Request.Form("x_last_name"))     
Dim x_address
    x_address = AssignDefaultValueIfBlank(Request.Form("x_address")) 
Dim x_city
    x_city = AssignDefaultValueIfBlank(Request.Form("x_city"))          
Dim x_state
    x_state = AssignDefaultValueIfBlank(Request.Form("x_state"))    
Dim x_zip
    x_zip = AssignDefaultValueIfBlank(Request.Form("x_zip"))   
Dim x_country
    x_country = AssignDefaultValueIfBlank(Request.Form("x_country"))     
Dim x_phone
    x_phone = AssignDefaultValueIfBlank(Request.Form("x_phone"))     
Dim x_fax
    x_fax = AssignDefaultValueIfBlank(Request.Form("x_fax")) 
Dim x_email
    x_email = AssignDefaultValueIfBlank(Request.Form("x_email"))           
Dim x_ship_to_company
    x_ship_to_company = AssignDefaultValueIfBlank(Request.Form("x_ship_to_company"))      
Dim x_ship_to_first_name
    x_ship_to_first_name = AssignDefaultValueIfBlank(Request.Form("x_ship_to_first_name"))    
Dim x_ship_to_last_name
    x_ship_to_last_name = AssignDefaultValueIfBlank(Request.Form("x_ship_to_last_name"))    
Dim x_ship_to_address
    x_ship_to_address = AssignDefaultValueIfBlank(Request.Form("x_ship_to_address"))    
Dim x_ship_to_city
    x_ship_to_city = AssignDefaultValueIfBlank(Request.Form("x_ship_to_city"))   
Dim x_ship_to_state
    x_ship_to_state = AssignDefaultValueIfBlank(Request.Form("x_ship_to_state"))       
Dim x_ship_to_zip
    x_ship_to_zip = AssignDefaultValueIfBlank(Request.Form("x_ship_to_zip"))     
Dim x_ship_to_country
    x_ship_to_country = AssignDefaultValueIfBlank(Request.Form("x_ship_to_country"))     
Dim x_invoice_num
    x_invoice_num = AssignDefaultValueIfBlank(Request.Form("x_invoice_num"))  
    
Dim textToHash 
    textToHash = "^" & x_trans_id  & "^" & x_test_request  & "^" & x_response_code  & "^" & x_auth_code  & "^" & x_cvv2_resp_code  & "^" & x_cavv_response  & "^" & x_avs_code  & "^" & x_method  & "^" & x_account_number  & "^" & x_amount  & "^" & x_company  & "^" & x_first_name  & "^" & x_last_name  & "^" & x_address  & "^" & x_city  & "^"
    textToHash = textToHash & x_state & "^" & x_zip & "^" & x_country & "^" & x_phone & "^" & x_fax & "^" & x_email & "^" & x_ship_to_company & "^" & x_ship_to_first_name & "^" & x_ship_to_last_name & "^" & x_ship_to_address & "^" & x_ship_to_city & "^" & x_ship_to_state & "^" & x_ship_to_zip & "^" & x_ship_to_country & "^" & x_invoice_num & "^"        

 

StringValue = "^^60117720851^false^1^H0ENJ3^P^2^Y^CC^XXXX0002^5.00^^Kim^Abunuwara^test, ,^Orem^UT^84097^United States of America^^^gartha@quickmerlin.com^^^^^^^^^1111651-MS-903088832^  "

Signature Key = DC3F79CD0C200E088B3E51EA84BFDC47EED00388F46C014C794D95BF499467EC31FA42AD7AEAFBEE88D9888CE777EF428D3B2C18915DAC2660CA3204A1C53AAB 

SHA512 = FD5AEB8713300C38B7D6A6E25624DE553832A62D56C58C9D5BA15A452863E521E215D16BA06CED8E040B37AA828DAE63470DE2870E4D446CC15A8004EA21ED50

 

Scenario 2

By using the string value (3 form fields)

apiLogin  = "3stJ86Ef"
transId  = "60117720851"
amount  = "5.00"

textToHash = "^" + apiLogin + "^" + transId + "^" + amount + "^"

                     = "^3stJ86Ef^60117720851^5.00^"

 

SHA512 = "7D2C2C0D1A98B4E6F67A7EAD80E019CAA8212D9139785BC7483BBF82A5B22CAC973D10EFD774EA93DE9D24D27B0CF56F477750220F02A95881D80AD8C7BCF6FD"

 

Both doesn't match the SHA512 value that was captured from the response.

 

Would really appreciate if you could advice which fields were used to determine the sHA512 value and whether the information is correct or if am missing something.

 

This is back and forth and amn't getting any were with this.

 

Please advice what am i missing?

 

Following is the .net code that was provided by you guys to calculate the SHA512 value

 

Looking forward to hear from you.

 

As this is delaying our full process and we have passed our deadline.

Ssooption11
Member
Who Me Too'd this topic