REST API | Barclays

Generate a Hash of the Claim Set

Generate a Base64-encoded SHA-256 hash the following header fields:
iat
The date and time of the message origin. Date formatting is defined by RFC 7231, Section 7.1.1.1.
digest
A Base64 encoded hash of the message payload.
The
digest
field is not included in a GET request.
digestAlgorithm
The algorithm used to has the message payload.
Thee message payload should be hashed using the SHA-256 algorithm.
The
digestAlgorithm
field is not included in a GET request.
To generate the hash:
  1. Generate a SHA-256 hash of the fields in JSON format.
  2. Encode the hashed string to Base64.
  3. Add the message body hash to the
    digest
    header field.

Example Claim Set Hash

NTk5NWE0ZjI3YjRiOTI1NmE5NGNmNTQ0ODlhOWVmNjkxZDhkYzhhNTkwZDMyMjc4MGQzYjIwMmNmYTJmMDc4Zg==

Code Example: Creating a Message Hash Using Command Line Tools

Generate the SHA-256 hash using the
shasum
tool.
echo -n "{"iat":"Thur, 15 June 2017 08:12:31 GMT","digest":"tP7hDajF4f6q0ysBQCHgef5K/PBq8iMASvlEARp8tl=", "digestAlgorithm":"SHA-256"}" | shasum -a 256

Code Example: Base 64 Encoding a Message Hash Using Command Line Tools

Generate the SHA-256 hash using the
shasum
tool.
echo -n "5995a4f27b4b9256a94cf54489a9ef691d8dc8a590d322780d3b202cfa2f078f" | base64