Replies: 1 comment 4 replies
-
MLE Announce messages are protected using a different key than what is used to protect all other MLE messages. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am using the OTNS simulator to create a network, then I take the pcap capture to parse it using the tools provided in "openthread-main\tests\scripts\thread-cert".
Here is the code :
def display_parsed_thread_packets(pcapng_path):
message_factory = config.create_default_thread_message_factory(network_key=config.DEFAULT_NETWORK_KEY)
Knowing that the network key in the otns is the default netkey, and this code parses all the other packets (all MLE, all ICMPv6 all coaps etc).
While it akes an error with the MLE announce packets :
Packet #1:
Traceback (most recent call last):
File "\TestParseurThread.py", line 113, in
display_parsed_thread_packets(pcapng_path)
File "\TestParseurThread.py", line 35, in display_parsed_thread_packets
message = message_factory.create(BytesIO(packet_data))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\openthread-main\tests\scripts\thread-cert\message.py", line 604, in create
mac_frame = self._parse_mac_frame(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\openthread-main\tests\scripts\thread-cert\message.py", line 591, in _parse_mac_frame
mac_frame.parse(data)
File "\openthread-main\tests\scripts\thread-cert\mac802154.py", line 372, in parse
self.payload = MacPayload(bytearray(open_payload) + sec_obj.decrypt(private_payload, mic, message_info))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\openthread-main\tests\scripts\thread-cert\net_crypto.py", line 91, in decrypt
dec_data = cipher.decrypt_and_verify(bytes(enc_data), bytes(mic))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Applications\Lib\site-packages\Crypto\Cipher_mode_ccm.py", line 597, in decrypt_and_verify
self.verify(received_mac_tag)
File "C:\Applications\Lib\site-packages\Crypto\Cipher_mode_ccm.py", line 538, in verify
raise ValueError("MAC check failed")
ValueError: MAC check failed
This error occurs eighter if the key is incorrect (which is not the case here), or if the mac part of the packet is not correctly parsed.
Do you have any idea of what might be the problem here please ?
Beta Was this translation helpful? Give feedback.
All reactions