From 6994ff0da7076ab161c91bfa5df09290faf1cec4 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 1 May 2014 12:57:35 -0700 Subject: Make public_numbers a property. --- cryptography/hazmat/primitives/asymmetric/rsa.py | 1 + docs/hazmat/primitives/asymmetric/rsa.rst | 14 ++++++++------ tests/hazmat/primitives/test_rsa.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cryptography/hazmat/primitives/asymmetric/rsa.py b/cryptography/hazmat/primitives/asymmetric/rsa.py index e84472c7..18fcac26 100644 --- a/cryptography/hazmat/primitives/asymmetric/rsa.py +++ b/cryptography/hazmat/primitives/asymmetric/rsa.py @@ -294,6 +294,7 @@ class RSAPrivateNumbers(object): def iqmp(self): return self._iqmp + @property def public_numbers(self): return self._public_numbers diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst index 5e6037de..8c34497e 100644 --- a/docs/hazmat/primitives/asymmetric/rsa.rst +++ b/docs/hazmat/primitives/asymmetric/rsa.rst @@ -357,14 +357,16 @@ RSA .. warning:: With the exception of the integers contained in the - :class:`RSAPublicNumbers` returned by the :meth:`public_numbers` - method, all attributes of this class must be kept secret. Revealing - them will compromise the security of any cryptographic operations - performed with a key derived from them. + :class:`RSAPublicNumbers` all attributes of this class must be kept + secret. Revealing them will compromise the security of any + cryptographic operations performed with a key loaded from them. - .. method:: public_numbers() + .. attribute:: public_numbers - :return: :class:`~cryptography.hazmat.primitives.rsa.RSAPublicNumbers` + :type: :class:`~cryptography.hazmat.primitives.rsa.RSAPublicNumbers` + + The :class:`RSAPublicNumbers` which makes up the RSA public key + associated with this RSA private key. .. attribute:: p diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index e60bfabf..6d3bf2ec 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -1509,4 +1509,4 @@ class TestRSANumbers(object): assert private_numbers.dmp1 == 1 assert private_numbers.dmq1 == 1 assert private_numbers.iqmp == 2 - assert private_numbers.public_numbers() == public_numbers + assert private_numbers.public_numbers == public_numbers -- cgit v1.2.3