diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-06-26 08:02:58 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-06-26 08:02:58 -0700 |
commit | 78cfc9e42a6780c85d670bb41fcc991ad9e1027c (patch) | |
tree | 6eb7a462b60207e9bc5449d6b55baf041d82764c | |
parent | eb00157d7deacd248b8638354ae0f809ea8964cd (diff) | |
parent | da208a9be574ed963fbb439de016fa4eea034e2c (diff) | |
download | cryptography-78cfc9e42a6780c85d670bb41fcc991ad9e1027c.tar.gz cryptography-78cfc9e42a6780c85d670bb41fcc991ad9e1027c.tar.bz2 cryptography-78cfc9e42a6780c85d670bb41fcc991ad9e1027c.zip |
Merge pull request #1184 from reaperhulk/rsa-read-only-keysize
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( |