Generate a Token Signature
You can now build the JSON token signature. The token signature is made up of the JWT
header and claim set hashes in the following format, and encrypted with the private
key.
[Token Header].[Claim Set]
Follow these steps to generate the signature:
- Concatenate the header and claim set hash strings with a period (.) separating the hashes:[Token Header].[Claim Set].
- Generate an encoded version of the text file using your private key.
- Base64 encode the signature output.
Example: Token Signature Hash
YjgwNGIxOTMxMzQ2NzhlYjdiMDdhMWZmYjZiYzUzNzliMTk5NzFmNjAzNWRmMThlNzk0N2NhY2U0YTEwNzYyYQ
Code Example: Encoding the Signature File Using OpenSSL
Encode the signature file using the
openssl
tool.openssl rsautl -encrypt -inkey publickey.key -pubin -in [signature-text-file] > [signature-encoded-file]
Code Example: Base64 Encoding the Signature File Using the Command Line
Encode the signature file using the
openssl
tool and remove any
padding.base64 -i [signature-encoded-file]