mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
req_pq is deprecated, use req_pq_multi instead
This commit is contained in:
parent
71f3e07dc1
commit
cc49815cc5
1 changed files with 14 additions and 3 deletions
|
|
@ -91,8 +91,19 @@ class Auth:
|
||||||
# Step 1; Step 2
|
# Step 1; Step 2
|
||||||
nonce = int.from_bytes(urandom(16), "little", signed=True)
|
nonce = int.from_bytes(urandom(16), "little", signed=True)
|
||||||
log.debug("Send req_pq: {}".format(nonce))
|
log.debug("Send req_pq: {}".format(nonce))
|
||||||
res_pq = self.send(functions.ReqPq(nonce))
|
res_pq = self.send(functions.ReqPqMulti(nonce))
|
||||||
log.debug("Got ResPq: {}".format(res_pq.server_nonce))
|
log.debug("Got ResPq: {}".format(res_pq.server_nonce))
|
||||||
|
log.debug("Server public key fingerprints: {}".format(res_pq.server_public_key_fingerprints))
|
||||||
|
|
||||||
|
for i in res_pq.server_public_key_fingerprints:
|
||||||
|
if i in RSA.server_public_keys:
|
||||||
|
log.debug("Using fingerprint: {}".format(i))
|
||||||
|
public_key_fingerprint = i
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
log.debug("Fingerprint unknown: {}".format(i))
|
||||||
|
else:
|
||||||
|
raise Exception("Public key not found")
|
||||||
|
|
||||||
# Step 3
|
# Step 3
|
||||||
pq = int.from_bytes(res_pq.pq, "big")
|
pq = int.from_bytes(res_pq.pq, "big")
|
||||||
|
|
@ -118,7 +129,7 @@ class Auth:
|
||||||
sha = sha1(data).digest()
|
sha = sha1(data).digest()
|
||||||
padding = urandom(- (len(data) + len(sha)) % 255)
|
padding = urandom(- (len(data) + len(sha)) % 255)
|
||||||
data_with_hash = sha + data + padding
|
data_with_hash = sha + data + padding
|
||||||
encrypted_data = RSA.encrypt(data_with_hash, res_pq.server_public_key_fingerprints[0])
|
encrypted_data = RSA.encrypt(data_with_hash, public_key_fingerprint)
|
||||||
|
|
||||||
log.debug("Done encrypt data with RSA")
|
log.debug("Done encrypt data with RSA")
|
||||||
|
|
||||||
|
|
@ -130,7 +141,7 @@ class Auth:
|
||||||
server_nonce,
|
server_nonce,
|
||||||
int.to_bytes(p, 4, "big"),
|
int.to_bytes(p, 4, "big"),
|
||||||
int.to_bytes(q, 4, "big"),
|
int.to_bytes(q, 4, "big"),
|
||||||
res_pq.server_public_key_fingerprints[0],
|
public_key_fingerprint,
|
||||||
encrypted_data
|
encrypted_data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue