Fix nonce calculation bug (fixes #5)

This commit is contained in:
Florian Bach 2021-10-23 21:36:47 +02:00
parent 8e8ca43c7e
commit 89dcaf75c1
3 changed files with 13 additions and 10 deletions

View File

@ -215,6 +215,8 @@ class ConfigWidget(QWidget):
self.button_export_key.setEnabled(activated)
self.button_export_activation.setEnabled(activated)
self.resize(self.sizeHint())
info_dialog(None, "Done", "Successfully imported authorization for " + ade_mail, show=True, show_copy_button=False)
@ -270,6 +272,8 @@ class ConfigWidget(QWidget):
self.button_export_key.setEnabled(True)
self.button_export_activation.setEnabled(True)
self.resize(self.sizeHint())
info_dialog(None, "Done", "Authorized to account " + mail, show=True, show_copy_button=False)
@ -293,7 +297,8 @@ class ConfigWidget(QWidget):
filters = [("DER Files", ["der"])]
filename = choose_save_file(self, "Export ADE keys", _("Export ADE keys"), filters, all_files=False)
filename = choose_save_file(self, "Export ADE keys", _("Export ADE keys"), filters,
all_files=False, initial_filename="adobe_encryption_key.der")
if (filename is None):
return

View File

@ -212,7 +212,7 @@ def sendPOSTHTTPRequest(URL: str, document: bytes, type: str, returnRC = False):
if returnRC:
return ret_code, content
return content
@ -274,15 +274,13 @@ def addNonce():
usec = dt.microsecond
sec = (dt - datetime(1970,1,1)).total_seconds()
nonce320 = int(0x6f046000)
nonce321 = int(0x388a)
bigtime = int(sec * 1000)
nonce320 += int((bigtime & 0xFFFFFFFF) + usec/1000)
nonce321 += int(((bigtime >> 32) & 0xFFFFFFFF))
Ntime = int(int(sec * 1000) + usec/1000)
final = bytearray(nonce320.to_bytes(4, 'little'))
final.extend(nonce321.to_bytes(4, 'little'))
# Unixtime to gregorian timestamp
Ntime += 62167219200000
final = bytearray(Ntime.to_bytes(8, 'little'))
tmp = 0
final.extend(tmp.to_bytes(4, 'little'))

View File

@ -547,7 +547,7 @@ def performFulfillmentNotification(fulfillmentResultToken, forceOptional = False
critical = True
if element.get("critical", "yes") == "no":
critial = False
critical = False
print("Notifying optional server %s" % (url))
else:
print("Notifying server %s" % (url))