Skip to content

Commit

Permalink
Match the signing alg with id_key alg
Browse files Browse the repository at this point in the history
Signed-off-by: David Mulder <[email protected]>
  • Loading branch information
dmulder committed Dec 7, 2023
1 parent ac46494 commit 366d5a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/crypto/tpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ where

fn update_header(&mut self, header: &mut ProtectedHeader) -> Result<(), JwtError> {
// Update the alg to match.
header.alg = JwaAlg::ES256;
match self.id_key.alg() {
KeyAlgorithm::Ecdsa256 => header.alg = JwaAlg::ES256,
KeyAlgorithm::Rsa2048 => header.alg = JwaAlg::RS256,
}

header.kid = Some(self.kid.clone());

Expand Down

0 comments on commit 366d5a3

Please sign in to comment.