Skip to content
Snippets Groups Projects
Commit 8b15c6ed authored by jkerdreu's avatar jkerdreu
Browse files

Fix the wrong header test, found by Ferllings

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/fork@1640 b32b6428-25c9-4566-ad07-03861ab6144f
parent 3b64b005
Branches
No related tags found
No related merge requests found
......@@ -99,19 +99,15 @@ class MessageFactory(object):
# Instanciate Message
msg = Message()
if 'targets'in data_rx:
try:
msg.targets = json.loads(data_rx['targets'])
elif 'version' in data_rx:
msg.version = data_rx['version']
elif 'timestamp' in data_rx:
msg.timestamp = data_rx['timestamp']
else:
raise MessageFactoryParserError("Bad Message, wrong fields")
msg_time = data_rx['timestamp'][0]
except KeyError:
raise MessageParserError("Bad Message, wrong fields")
# Replay attack, window fixed to CIPHER_WINDOW in seconds
now = build_timestamp()[0] # test done only on seconds ...
msg_time = data_rx['timestamp'][0]
if msg_time < (now - config.cipher_window):
raise MessageParserError("Potential replay attack, message too old")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment