Skip to content

Commit fb024d6

Browse files
committed
add assert length check to decrypt_int_fast
pass modulus to decrypt_int_fast
1 parent baabcc7 commit fb024d6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

rsa/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def decrypt_int_fast(
6666
rs: typing.List[int],
6767
ds: typing.List[int],
6868
ts: typing.List[int],
69+
n: int,
6970
) -> int:
7071
"""Decrypts a cypher text more quickly using the Chinese Remainder Theorem."""
7172

@@ -76,6 +77,8 @@ def decrypt_int_fast(
7677
assert_int(d, "d")
7778
for t in ts:
7879
assert_int(t, "t")
80+
81+
assert_length(cyphertext, n)
7982

8083
p, q, rs = rs[0], rs[1], rs[2:]
8184
exp1, exp2, ds = ds[0], ds[1], ds[2:]

rsa/key.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ def blinded_decrypt(self, encrypted: int) -> int:
551551
[self.p, self.q] + self.rs,
552552
[self.exp1, self.exp2] + self.ds,
553553
[self.coef] + self.ts,
554+
self.n,
554555
)
555556
return self.unblind(decrypted, blindfac_inverse)
556557

0 commit comments

Comments
 (0)