{"_id":"5734bb9ed158c53200163a35","category":{"_id":"57348e6e6a42521700a246fb","version":"573243608b55962900f063c1","__v":0,"project":"573243608b55962900f063c0","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-12T14:08:46.274Z","from_sync":false,"order":7,"slug":"generating-signature","title":"How to Generate Signature Hash"},"parentDoc":null,"__v":22,"project":"573243608b55962900f063c0","user":"57335cb1a6a9c40e00e139e2","version":{"_id":"573243608b55962900f063c1","__v":9,"project":"573243608b55962900f063c0","createdAt":"2016-04-19T15:51:35.494Z","releaseDate":"2016-04-19T15:51:35.494Z","categories":["573243608b55962900f063c3","573243608b55962900f063c2","573255b9ee92510e00087821","573255c0384fc70e0050ea42","573255ce9ef0fa0e0083f0d4","57334604b90dba1900b3d90c","5733474f45fc0c0e00c154da","57348e6e6a42521700a246fb","57348e79a210200e005f99e2","5734efd57e13fd17002f1129","5746204e04f2410e00a5a2e4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-12T17:21:34.824Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"HMAC SHA256 is used to encrypt data transmission. A signature element is added during Web Services Requests and Responses.  This Signature element is an HEXA representation of the SHA256 Hash.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Signature>Signature</Signature>\\n\\nData = Plaint Text Data to hash\\nSignatureKey = Part of SafetyPay Credentials\",\n      \"language\": \"css\",\n      \"name\": \" \"\n    }\n  ]\n}\n[/block]\n**SeudoCode:**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HashedMessage = ComputeHash_SHA256 (Data + SignatureKey)\\n     Signature = ConvertToHexa (HashedMessage)\",\n      \"language\": \"css\",\n      \"name\": \" \"\n    }\n  ]\n}\n[/block]\n **Example:**  \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Declaring Variables\\nData = RequestDateField + SignatureKey\\nRequestDateField = 08-01-2008T12:24\\nSignatureKey = 456123ASD456123ASD456123123123\\n\\n// Calculating Signature\\nHashedMessage = ComputeHash_SHA256 (08-01-2008T12:24456123ASD456123ASD456123123123)\\nSHA256 returns a result of 256 bits = 32 bytes; for interoperability is preferred to be converted to HEXA.\\nSignature = ConvertToHexa (HashedMessage)\\nSignature = 7B6167F979E10AEB30AE0B0E0F594D3B559E3EA6C204497E534CA47D5EB78AAD\",\n      \"language\": \"css\",\n      \"name\": \" \"\n    }\n  ]\n}\n[/block]\nThis value will be added in the Web Services call, element signature.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Signature>7B6167F979E10AEB30AE0B0E0F594D3B559E3EA6C204497E534CA47D5EB78AAD</Signature>\",\n      \"language\": \"css\",\n      \"name\": \" \"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"generating-the-signature","type":"basic","title":"Generating the Signature"}

Generating the Signature


HMAC SHA256 is used to encrypt data transmission. A signature element is added during Web Services Requests and Responses. This Signature element is an HEXA representation of the SHA256 Hash. [block:code] { "codes": [ { "code": "<Signature>Signature</Signature>\n\nData = Plaint Text Data to hash\nSignatureKey = Part of SafetyPay Credentials", "language": "css", "name": " " } ] } [/block] **SeudoCode:** [block:code] { "codes": [ { "code": "HashedMessage = ComputeHash_SHA256 (Data + SignatureKey)\n Signature = ConvertToHexa (HashedMessage)", "language": "css", "name": " " } ] } [/block] **Example:** [block:code] { "codes": [ { "code": "// Declaring Variables\nData = RequestDateField + SignatureKey\nRequestDateField = 08-01-2008T12:24\nSignatureKey = 456123ASD456123ASD456123123123\n\n// Calculating Signature\nHashedMessage = ComputeHash_SHA256 (08-01-2008T12:24456123ASD456123ASD456123123123)\nSHA256 returns a result of 256 bits = 32 bytes; for interoperability is preferred to be converted to HEXA.\nSignature = ConvertToHexa (HashedMessage)\nSignature = 7B6167F979E10AEB30AE0B0E0F594D3B559E3EA6C204497E534CA47D5EB78AAD", "language": "css", "name": " " } ] } [/block] This value will be added in the Web Services call, element signature. [block:code] { "codes": [ { "code": "<Signature>7B6167F979E10AEB30AE0B0E0F594D3B559E3EA6C204497E534CA47D5EB78AAD</Signature>", "language": "css", "name": " " } ] } [/block]