You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decription : i am trying to build a dissector for TREL packets in wireshark , i have followed discussion 9267 ,
i got packet captures related to TREL packets , i got to know that KeyManager::ComputeTrelKey is used to generate the trel key i have generate trel key code below
importhashlibimporthmacimportbinasciidefhkdf(key, salt, output_length):
""" Trel key generation Derives a new key from an input key using HMAC-based Extract-and-Expand. Args: key: The input key. salt: A random value used to make the derived key more secure. output_length: The desired length of the derived key. Returns: The derived key. """prk=hmac.digest(key, salt, hashlib.sha256)
output=prkwhilelen(output) <output_length:
output+=hmac.digest(output, prk, hashlib.sha256)
output=output[:output_length]
returnoutputdefmain():
key_in_hex='00112233445566778899aabbccddeeff'key_in_bytes=binascii.unhexlify(key_in_hex)
salt_in_hex="0000000054687265616453657175656e63654d61737465724b6579"salt_in_bytes=binascii.unhexlify(salt_in_hex)
output_length=int("32", 10)
derived_key=hkdf(key_in_bytes, salt_in_bytes, output_length)
hex_string=""forbyteinderived_key:
hex_string+=f"{byte:02x}"print("Derived Trel key:",hex_string)
last_16_bytes=hex_string[-32:]
print(last_16_bytes)
if__name__=="__main__":
main()
salt in above code is seq_counter= 00000000 + 'ThreadSequenceMasterKey'
key is standard key thread-spec 1.3
data i need to decode hex string (trel packet payload) dce55bc70cd8dce55bcce09386dd6008a27a005d1140fdda38148394a8deccb9128bb9d93560fdda38148394a8de1938b620a9e05dc4de62bf23005d6aaf0018d464000000211243e48f16ae4a7341d8ba64d4ffff734aae168fe443127f3b01f04d4c4d4c784f001566650000000000000188092ced99faaa8a967d32bcefae3831c0e084c652f91b86281edefae2d33a87e8
Expectation : i want to decode above hex string with the key i generated if i generated correct key. and if key is correct how do decode string?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Decription : i am trying to build a dissector for TREL packets in wireshark , i have followed discussion 9267 ,
i got packet captures related to TREL packets , i got to know that
KeyManager::ComputeTrelKey
is used to generate the trel key i have generate trel key code belowsalt in above code is
seq_counter= 00000000 + 'ThreadSequenceMasterKey'
key is standard key thread-spec 1.3
Generated key
Derived Trel key: 7c6f79a038331379e9cbb0cda64689894c2b543e32571dae4ebb48a9ab559581
data i need to decode hex string (trel packet payload)
dce55bc70cd8dce55bcce09386dd6008a27a005d1140fdda38148394a8deccb9128bb9d93560fdda38148394a8de1938b620a9e05dc4de62bf23005d6aaf0018d464000000211243e48f16ae4a7341d8ba64d4ffff734aae168fe443127f3b01f04d4c4d4c784f001566650000000000000188092ced99faaa8a967d32bcefae3831c0e084c652f91b86281edefae2d33a87e8
Expectation : i want to decode above hex string with the key i generated if i generated correct key. and if key is correct how do decode string?
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions