Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CoseKey field ordering #85

Merged
merged 3 commits into from
Jan 12, 2024
Merged

Conversation

daviddrysdale
Copy link
Collaborator

No description provided.

Lexicographic,
/// Order values by encoded length, then by lexicographic ordering of encoded form, as per RFC
/// 7049 section 3.9 (Canonical CBOR).
LengthLexicographic,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LengthFirstLexicographic ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

src/key/tests.rs Outdated
struct TestCase {
key_data: &'static str, // hex
canonical_key: CoseKey,
deterministic_key: CoseKey,
Copy link
Collaborator

@AlanStokes AlanStokes Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "deterministic" mean here? How does it relate to "canonical"?

Maybe "old_canonical", "new_canonical"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFC 7049 talks about "canonical CBOR", RFC 8949 talks about "deterministic encoding".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but RFC 7049 is obsoleted by RFC 8949, so both are deterministic now. (And it says "The terms are essentially interchangeable".)

We don't use the term deterministic elsewhere in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Deterministic" isn't mentioned elsewhere in the code because CBOR/COSE spec tried quite hard to avoid it being necessary – they just missed that COSE_Key is likely to end up being signed-over in chains.

Moved to use rfcNNNN_ prefixes.

@daviddrysdale daviddrysdale merged commit 2eed112 into google:main Jan 12, 2024
21 checks passed
@daviddrysdale daviddrysdale deleted the key-sort branch January 12, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants