Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 1.13 KB

json-web-signatures.md

File metadata and controls

19 lines (13 loc) · 1.13 KB

JSON Web Signatures

From Wikipedia:

A JSON Web Signature (abbreviated JWS) is an IETF-proposed standard (RFC 7515) for signing arbitrary data.[1] This is used as the basis for a variety of web-based technologies including JSON Web Token.

{% raw %}
{% capture private_key_pem = options.private_key_pem__required_code_multiline %}

{% assign claims = options.payload_json__code_multiline | parse_json | json | base64_url_safe_encode %}
{% assign header = '{"alg":"RS256","typ":"JWT"}' | base64_encode %}
{% assign input = header | append: "." | append: claims %}

{% assign signature = input | rsa_sha256: private_key_pem | base64_url_safe_encode %}

{% log header: header, claims: claims, input: input, signature: signature %}
{% endraw %}