NUT10/NUT11 canonical serialization of secret. #278
Labels
No labels
breaking change
bug
documentation
enhancement
needs discussion
needs implementation
new nut
ready
wallet-only
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-admin/nuts#278
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For NUT10 (), the
proof.secretis a JSON of the format:The recipient who owns the private key of the public key Secret.data can spend the proof by providing a signature on the serialized Proof.secret. If this
proof.secretis deserialized and reserialized between the sender and the receiver, the signature might not match the original proof.secret serialization (the hash of serialized secrets could differ).This can be a problem if the proof.secret is processed between sender and receiver. For example, in the Satocash smartcard ecash wallet, the P2PK proofs are deserialized for efficient storage and processing. The proof.secret is then reserialized for signature, which can create issue if the reconstructed proof.secret string does not match the original one.
For illustration, the NUT11 provides an example of serialized
proof.secret:Using Nutshell
sendcommand with thelockargument, we get a decodedproof.secretof the following format:Where the
dataandnoncepositions are different, and additional whitespaces are added. Even if thedataandnoncevalues were the same, the hashes would not match, so signature or proof verification would fail.To mitigate this issue, the 'proof.secret' serialization should be required to use canonical serialization such as RFC8785. This basically defines rules for transforming JSON into a canonical form:
Any updates on this issue?