aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-06-25 20:48:26 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-06-25 20:48:26 -0600
commitda208a9be574ed963fbb439de016fa4eea034e2c (patch)
tree164fc9e8d14ca564e2cea7eed809bdcd949313cf
parent1cf0046789a1aeca1fd8b1da89488986f2539566 (diff)
downloadcryptography-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.py12
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(