On This Page
REST API
Generating a Hash of the Token Header
Generate a Base64-encoded SHA-256 hash of these header fields:
- kid
- The ID of the key used to digitally sign the JWT.
- alg
- Algorithm used to sign the token header.
- v-c-merchant-id
- Merchant ID used in the request transaction.
Follow these steps to generate the hash:
- Generate the SHA-256 hash of the fields in JSON format.
- Encode the hashed string to Base64.
Example: Token Header Hash
NTc3N2RlOTAyZWEwNWU0NWM2YTBkNTI4Mjg0YTJmOTVlZGYxYWJlMzBjNzk5OTg1YzEzMjNiMDkzMzc0MWEwNA==
Code Example: Creating a Message Hash Using Command Line Tools
Generate the SHA-256 hash using the
shasum
tool.echo -n "{"kid":"cc34c0a0-bd5a-4a3c-a50d-a2a7db7643df", "alg":"RS256","v-c-merchant-id":"merchant_id"}" | shasum -a 256
Base64-encode the hash value using the
base64
tool.echo -n "a9953cdca19433ae5ec1c4eb0dafd41df6de4d20cd47cbace3c316a1ac6d2008" | base64