diff options
author | Bu Sun Kim <busunkim@google.com> | 2021-02-19 01:05:54 +0000 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2021-02-24 11:32:07 +0100 |
commit | eb6ddb6e3ec5cf3a512f1854adb6ed1ad318ea4e (patch) | |
tree | 46a57357f60a86d033d5fe80aab6b32393c589ec /rsa | |
parent | 758562f004ead1c999b297334d552b57404c21d2 (diff) | |
download | rsa-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.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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: |