-
Notifications
You must be signed in to change notification settings - Fork 421
Description
Description
This library currently does not implement the JSON Canonicalization Scheme (JCS) as defined in RFC 8785. As a result, it cannot be reliably used for token signing or signature verification, since JSON objects with the same semantic content can be serialized in different key orders. For example:
{ "a": 1, "b": 2 }
{ "b": 2, "a": 1 }Although these two representations describe identical data, their serialized byte forms differ. This discrepancy can cause signature validation failures - particularly in cross-language environments where tokens are generated in one language (e.g., JavaScript, Python, or PHP) and verified in Go.
To ensure interoperability and security, the library should follow the canonicalization rules described in RFC 8785. At a minimum, object keys should be consistently sorted prior to serialization.
Implementing JCS or providing an option to enable canonical encoding would significantly improve the library’s reliability for cryptographic operations and multi-language compatibility.