From a5201a8ab40611427eef3bb93595406b64ca3d60 Mon Sep 17 00:00:00 2001 From: Vincent Ruello <5345986+vruello@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:13:45 +0200 Subject: [PATCH] Fix salt retrival with aes128-cts-hmac-sha1-96 --- gmsad/salt.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gmsad/salt.py b/gmsad/salt.py index 4105e9d..06289e9 100644 --- a/gmsad/salt.py +++ b/gmsad/salt.py @@ -349,7 +349,8 @@ def get_salt_from_rep(kdc_rep: bytes) -> str: if padata['padata-type'].native == PA_ETYPE_INFO2: etype = ETYPE_INFO2() for pa_etype_info2_value in etype.load(padata['padata-value'].native): - if pa_etype_info2_value['etype'].native == AES256_CTS_HMAC_SHA1h96_ENC_TYPE: + if (pa_etype_info2_value['etype'].native == AES256_CTS_HMAC_SHA1h96_ENC_TYPE + or pa_etype_info2_value['etype'].native == AES128_CTS_HMAC_SHA1_96_ENC_TYPE): # XXX: Adding str just for mypy return str(pa_etype_info2_value['salt'].native) else: @@ -362,8 +363,8 @@ def get_salt_from_rep(kdc_rep: bytes) -> str: if padata['padata-type'] == PA_ETYPE_INFO2: etype = ETYPE_INFO2() for pa_etype_info2_value in etype.load(padata['padata-value']): - if pa_etype_info2_value['etype'].native == AES256_CTS_HMAC_SHA1h96_ENC_TYPE \ - or pa_etype_info2_value['etype'].native == AES128_CTS_HMAC_SHA1_96_ENC_TYPE: + if (pa_etype_info2_value['etype'].native == AES256_CTS_HMAC_SHA1h96_ENC_TYPE + or pa_etype_info2_value['etype'].native == AES128_CTS_HMAC_SHA1_96_ENC_TYPE): # XXX: Adding str just for mypy return str(pa_etype_info2_value['salt']) raise Exception("Could not retrieve salt from AS_REP (tag number %d)" % tag)