diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-25 20:48:26 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-25 20:48:26 -0600 |
commit | da208a9be574ed963fbb439de016fa4eea034e2c (patch) | |
tree | 164fc9e8d14ca564e2cea7eed809bdcd949313cf | |
parent | 1cf0046789a1aeca1fd8b1da89488986f2539566 (diff) | |
download | cryptography-da208a9be574ed963fbb439de016fa4eea034e2c.tar.gz cryptography-da208a9be574ed963fbb439de016fa4eea034e2c.tar.bz2 cryptography-da208a9be574ed963fbb439de016fa4eea034e2c.zip |
Make OpenSSL RSA key_size attr read only
-rw-r--r-- | cryptography/hazmat/backends/openssl/rsa.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/openssl/rsa.py b/cryptography/hazmat/backends/openssl/rsa.py index 2fada1b9..a62a89f4 100644 --- a/cryptography/hazmat/backends/openssl/rsa.py +++ b/cryptography/hazmat/backends/openssl/rsa.py @@ -422,7 +422,11 @@ class _RSAPrivateKey(object): assert res == 1 self._evp_pkey = evp_pkey - self.key_size = self._backend._lib.BN_num_bits(self._rsa_cdata.n) + self._key_size = self._backend._lib.BN_num_bits(self._rsa_cdata.n) + + @property + def key_size(self): + return self._key_size def signer(self, padding, algorithm): return _RSASignatureContext(self._backend, self, padding, algorithm) @@ -474,7 +478,11 @@ class _RSAPublicKey(object): assert res == 1 self._evp_pkey = evp_pkey - self.key_size = self._backend._lib.BN_num_bits(self._rsa_cdata.n) + self._key_size = self._backend._lib.BN_num_bits(self._rsa_cdata.n) + + @property + def key_size(self): + return self._key_size def verifier(self, signature, padding, algorithm): return _RSAVerificationContext( |