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

20240131 prt hmac #21

Merged
merged 3 commits into from
Feb 7, 2024
Merged

20240131 prt hmac #21

merged 3 commits into from
Feb 7, 2024

Conversation

Firstyear
Copy link
Member

Supersedes/Incorporates #20, this improves our support for PRTv2 decryption as well as signing and verifying JWS messages with derived keys.

  • [ x ] cargo fmt has been run
  • [ x ] cargo test has been run and passes
  • documentation has been updated with relevant examples (if relevant)

@Firstyear Firstyear requested a review from dmulder February 6, 2024 07:24
src/crypto/mod.rs Outdated Show resolved Hide resolved
@dmulder
Copy link
Collaborator

dmulder commented Feb 6, 2024

You've also got some dead code:

warning: method `raw_key` is never used
  --> src/crypto/a256gcm.rs:30:19
   |
29 | impl JweA256GCMEncipher {
   | ----------------------- method in this implementation
30 |     pub(crate) fn raw_key(&self) -> [u8; KEY_LEN] {
   |                   ^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: method `ms_oapxbc_key` is never used
   --> src/crypto/a256gcm.rs:120:19
    |
119 | impl JweA256GCMEncipher {
    | ----------------------- method in this implementation
120 |     pub(crate) fn ms_oapxbc_key(&self) -> &[u8] {
    |                   ^^^^^^^^^^^^^

warning: `compact_jwt` (lib) generated 2 warnings

@dmulder
Copy link
Collaborator

dmulder commented Feb 6, 2024

I built and ran it against Azure and the derived key signing works as expected :)

@dmulder
Copy link
Collaborator

dmulder commented Feb 6, 2024

You've also got some dead code:

warning: method `raw_key` is never used
  --> src/crypto/a256gcm.rs:30:19
   |
29 | impl JweA256GCMEncipher {
   | ----------------------- method in this implementation
30 |     pub(crate) fn raw_key(&self) -> [u8; KEY_LEN] {
   |                   ^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: method `ms_oapxbc_key` is never used
   --> src/crypto/a256gcm.rs:120:19
    |
119 | impl JweA256GCMEncipher {
    | ----------------------- method in this implementation
120 |     pub(crate) fn ms_oapxbc_key(&self) -> &[u8] {
    |                   ^^^^^^^^^^^^^

warning: `compact_jwt` (lib) generated 2 warnings

Well, that's odd. I can see raw_key is used by begin_rsa_oaep_key_agreement, which is a public function. That warning doesn't make sense. ms_oapxbc_key on the other hand clearly isn't used anywhere.

@Firstyear
Copy link
Member Author

Sorry about that, I accidentally disabled warnings and forget to re-enable them. Re-tested with the various feature combinations, and it works now. Also addressed your other comments.

@dmulder
Copy link
Collaborator

dmulder commented Feb 7, 2024

LGTM

@dmulder dmulder merged commit 9a626aa into main Feb 7, 2024
1 check passed
@dmulder dmulder deleted the 20240131-prt-hmac branch February 7, 2024 13:44
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