master
Bob Mottram 2019-08-23 12:31:46 +01:00
parent bb6dfbd7f9
commit a2e3208999
1 changed files with 3 additions and 0 deletions

View File

@ -120,6 +120,9 @@ def createSignedHeader(privateKeyPem: str,nickname: str, \
return headers return headers
def verifyRecentSignature(signedDateStr: str) -> bool: def verifyRecentSignature(signedDateStr: str) -> bool:
"""Checks whether the given time taken from the header is within
12 hours of the current time
"""
currDate=datetime.datetime.utcnow() currDate=datetime.datetime.utcnow()
signedDate=datetime.datetime.strptime(signedDateStr,"%a, %d %b %Y %H:%M:%S %Z") signedDate=datetime.datetime.strptime(signedDateStr,"%a, %d %b %Y %H:%M:%S %Z")
# 12 hours tollerance # 12 hours tollerance