Skip to content

Commit

Permalink
Add function for deciphering MS TGTs
Browse files Browse the repository at this point in the history
Signed-off-by: David Mulder <[email protected]>
  • Loading branch information
dmulder committed Oct 31, 2024
1 parent c1465c1 commit 92afdfe
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/crypto/ms_oapxbc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ impl MsOapxbcSessionKey {
})
}

/// Given an encrypted TGT key, decipher it and return a new LoadableMsOapxbcSessionKey
pub fn decipher_tgt_client_key<T>(
&self,
tpm: &mut T,
msrsa_key: &MsOapxbcRsaKey,
encrypted_client_key: &[u8],
) -> Result<LoadableMsOapxbcSessionKey, JwtError>
where
T: Tpm,
{
match &self {
MsOapxbcSessionKey::A256GCM {
loadable_session_key,
} => tpm
.msoapxbc_rsa_decipher_tgt_session_key(msrsa_key, loadable_session_key, encrypted_client_key)
.map_err(|tpm_err| {
error!(?tpm_err);
JwtError::TpmError
}),
}
}

/// Given a JWE in compact form, decipher and authenticate its content.
pub fn decipher<T>(
&self,
Expand Down

0 comments on commit 92afdfe

Please sign in to comment.