summaryrefslogtreecommitdiff
path: root/rsa
diff options
context:
space:
mode:
authorBu Sun Kim <busunkim@google.com>2021-02-19 01:05:54 +0000
committerSybren A. Stüvel <sybren@stuvel.eu>2021-02-24 11:32:07 +0100
commiteb6ddb6e3ec5cf3a512f1854adb6ed1ad318ea4e (patch)
tree46a57357f60a86d033d5fe80aab6b32393c589ec /rsa
parent758562f004ead1c999b297334d552b57404c21d2 (diff)
downloadrsa-git-eb6ddb6e3ec5cf3a512f1854adb6ed1ad318ea4e.tar.gz
Fix #173: unpickling doesn't restore full object
When a `PrivateKey` or `PublicKey` is unpickled `AbstractKey.__init__()` should be called so `self.mutex` and `self.blindfac` are created.
Diffstat (limited to 'rsa')
-rw-r--r--rsa/key.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/rsa/key.py b/rsa/key.py
index d84ae05..e61bac1 100644
--- a/rsa/key.py
+++ b/rsa/key.py
@@ -251,6 +251,7 @@ class PublicKey(AbstractKey):
def __setstate__(self, state: typing.Tuple[int, int]) -> None:
"""Sets the key from tuple."""
self.n, self.e = state
+ AbstractKey.__init__(self, self.n, self.e)
def __eq__(self, other: typing.Any) -> bool:
if other is None:
@@ -426,6 +427,7 @@ class PrivateKey(AbstractKey):
def __setstate__(self, state: typing.Tuple[int, int, int, int, int, int, int, int]) -> None:
"""Sets the key from tuple."""
self.n, self.e, self.d, self.p, self.q, self.exp1, self.exp2, self.coef = state
+ AbstractKey.__init__(self, self.n, self.e)
def __eq__(self, other: typing.Any) -> bool:
if other is None: