From ac423232f884b94a24257e80ac95cccd5749ba9f Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 25 Jan 2014 14:13:09 -0600 Subject: RSA private/public key interface + docs --- docs/hazmat/primitives/interfaces.rst | 100 ++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index edb24cd9..40b49a54 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -102,3 +102,103 @@ Interfaces used by the symmetric cipher modes described in Exact requirements of the nonce are described by the documentation of individual modes. + +Asymmetric Interfaces +~~~~~~~~~~~~~~~~~~~~~ + +.. class:: RSAPrivateKey + + An `RSA`_ private key. + + .. attribute:: public_key + + :type: :class:`~cryptography.hazmat.primitives.interfaces.RSAPublicKey` + + An RSA public key object corresponding to the values of the private key. + + .. attribute:: modulus + + :type: str + + Hexadecimal representation of the public modulus. Alias for ``n``. + + .. attribute:: public_exponent + + :type: int + + The public exponent. Alias for ``e``. + + .. attribute:: key_length + + :type: int + + The bit length of the modulus. + + .. attribute:: p + + :type: str + + Hexadecimal representation of ``p``, one of the two primes composing + ``n``. + + .. attribute:: q + + :type: str + + Hexadecimal representation of ``q``, one of the two primes composing + ``n``. + + .. attribute:: d + + :type: str + + Hexadecimal representation of ``d``, the private exponent. + + .. attribute:: n + + :type: str + + Hexadecimal representation of the public modulus. + + .. attribute:: e + + :type: int + + The public exponent. + + +.. class:: RSAPublicKey + + An `RSA`_ public key. + + .. attribute:: modulus + + :type: str + + Hexadecimal representation of the public modulus. Alias for ``n``. + + .. attribute:: key_length + + :type: int + + The bit length of the modulus. + + .. attribute:: public_exponent + + :type: int + + The public exponent. Alias for ``e``. + + .. attribute:: n + + :type: str + + Hexadecimal representation of the public modulus. + + .. attribute:: e + + :type: int + + The public exponent. + +.. _`RSA`: http://en.wikipedia.org/wiki/RSA_(cryptosystem) -- cgit v1.2.3 From d527b30d2f4515ea8d2c9af7fe7317dcab276aff Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 26 Jan 2014 11:41:38 -0600 Subject: update interface docs to make attributes return int (per irc discussion) --- docs/hazmat/primitives/interfaces.rst | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 40b49a54..c2d4c53d 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -118,9 +118,9 @@ Asymmetric Interfaces .. attribute:: modulus - :type: str + :type: int - Hexadecimal representation of the public modulus. Alias for ``n``. + The public modulus. Alias for ``n``. .. attribute:: public_exponent @@ -136,29 +136,27 @@ Asymmetric Interfaces .. attribute:: p - :type: str + :type: int - Hexadecimal representation of ``p``, one of the two primes composing - ``n``. + ``p``, one of the two primes composing ``n``. .. attribute:: q - :type: str + :type: int - Hexadecimal representation of ``q``, one of the two primes composing - ``n``. + ``q``, one of the two primes composing ``n``. .. attribute:: d - :type: str + :type: int - Hexadecimal representation of ``d``, the private exponent. + The private exponent. .. attribute:: n - :type: str + :type: int - Hexadecimal representation of the public modulus. + The public modulus. .. attribute:: e @@ -173,9 +171,9 @@ Asymmetric Interfaces .. attribute:: modulus - :type: str + :type: int - Hexadecimal representation of the public modulus. Alias for ``n``. + The public modulus. Alias for ``n``. .. attribute:: key_length @@ -191,9 +189,9 @@ Asymmetric Interfaces .. attribute:: n - :type: str + :type: int - Hexadecimal representation of the public modulus. + The public modulus. .. attribute:: e -- cgit v1.2.3 From 0e94fbe27e3942620906b7f275fa69c55defacd5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 26 Jan 2014 11:47:21 -0600 Subject: make public_key an abstractmethod, update docs --- docs/hazmat/primitives/interfaces.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index c2d4c53d..02ba10e2 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -110,7 +110,7 @@ Asymmetric Interfaces An `RSA`_ private key. - .. attribute:: public_key + .. method:: public_key() :type: :class:`~cryptography.hazmat.primitives.interfaces.RSAPublicKey` @@ -120,13 +120,13 @@ Asymmetric Interfaces :type: int - The public modulus. Alias for ``n``. + The public modulus. .. attribute:: public_exponent :type: int - The public exponent. Alias for ``e``. + The public exponent. .. attribute:: key_length @@ -156,13 +156,13 @@ Asymmetric Interfaces :type: int - The public modulus. + The public modulus. Alias for ``modulus``. .. attribute:: e :type: int - The public exponent. + The public exponent. Alias for ``public_exponent``. .. class:: RSAPublicKey @@ -173,7 +173,7 @@ Asymmetric Interfaces :type: int - The public modulus. Alias for ``n``. + The public modulus. .. attribute:: key_length @@ -185,18 +185,18 @@ Asymmetric Interfaces :type: int - The public exponent. Alias for ``e``. + The public exponent. .. attribute:: n :type: int - The public modulus. + The public modulus. Alias for ``modulus``. .. attribute:: e :type: int - The public exponent. + The public exponent. Alias for ``public_exponent``. .. _`RSA`: http://en.wikipedia.org/wiki/RSA_(cryptosystem) -- cgit v1.2.3 From 359b94631c3380e2f86cf1f8e95090f7a350438f Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 26 Jan 2014 12:03:05 -0600 Subject: methods don't have a type, they return things --- docs/hazmat/primitives/interfaces.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 02ba10e2..57a84120 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -112,7 +112,7 @@ Asymmetric Interfaces .. method:: public_key() - :type: :class:`~cryptography.hazmat.primitives.interfaces.RSAPublicKey` + :return: :class:`~cryptography.hazmat.primitives.interfaces.RSAPublicKey` An RSA public key object corresponding to the values of the private key. -- cgit v1.2.3 From 82629f4adc8bfc8899b2b99915fad61b95e17fe6 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 26 Jan 2014 12:25:02 -0600 Subject: adding versionadded --- docs/hazmat/primitives/interfaces.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 57a84120..0c193bd5 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -108,6 +108,8 @@ Asymmetric Interfaces .. class:: RSAPrivateKey +.. versionadded:: 0.2 + An `RSA`_ private key. .. method:: public_key() @@ -167,6 +169,8 @@ Asymmetric Interfaces .. class:: RSAPublicKey +.. versionadded:: 0.2 + An `RSA`_ public key. .. attribute:: modulus -- cgit v1.2.3 From 46688b11ed7b4f8c53a61feb1bf355a38d3e939c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 26 Jan 2014 13:23:13 -0600 Subject: indentation is fun --- docs/hazmat/primitives/interfaces.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 0c193bd5..4739680a 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -108,7 +108,7 @@ Asymmetric Interfaces .. class:: RSAPrivateKey -.. versionadded:: 0.2 + .. versionadded:: 0.2 An `RSA`_ private key. @@ -169,7 +169,7 @@ Asymmetric Interfaces .. class:: RSAPublicKey -.. versionadded:: 0.2 + .. versionadded:: 0.2 An `RSA`_ public key. -- cgit v1.2.3