From ce5a32f3fdbcb5128800719e2c3d68e6248d3e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 20 Jul 2022 11:00:13 +0200 Subject: Fix #199: Sphinx warnings reference target not found Fix the documentation by adding referenced-but-not-included functions and some other small fixes. The only warnings left are: ``` python-rsa/rsa/key.py:docstring of rsa.key.AbstractKey.load_pkcs1:: WARNING: py:class reference target not found: rsa.key.T python-rsa/rsa/key.py:docstring of rsa.key.AbstractKey.load_pkcs1:: WARNING: py:class reference target not found: rsa.key.T ``` These are due to Sphynx not really understanding `typing` type references. Not sure how to fix those. --- doc/reference.rst | 10 +++++++++- doc/usage.rst | 2 +- rsa/pkcs1.py | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/reference.rst b/doc/reference.rst index 9da7c6b..a0d9b6b 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -17,7 +17,13 @@ Functions .. autofunction:: rsa.find_signature_hash -.. autofunction:: rsa.newkeys(keysize) +.. autofunction:: rsa.newkeys + +.. autofunction:: rsa.sign_hash + +.. autofunction:: rsa.compute_hash + +.. autodata:: rsa.pkcs1.HASH_METHODS Classes @@ -31,6 +37,8 @@ Classes constructed data. Never unpickle data received from an untrusted or unauthenticated source. +.. autoclass:: rsa.key.AbstractKey + .. autoclass:: rsa.PublicKey :members: :inherited-members: diff --git a/doc/usage.rst b/doc/usage.rst index a55a2bc..5c60e2d 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -214,7 +214,7 @@ Modify the message, and the signature is no longer valid and a makes cracking the keys easier. Instead of a message you can also call :py:func:`rsa.sign` and -:py:func:`rsa.verify` with a :py:class:`file`-like object. If the +:py:func:`rsa.verify` with a `file`-like object. If the message object has a ``read(int)`` method it is assumed to be a file. In that case the file is hashed in 1024-byte blocks at the time. diff --git a/rsa/pkcs1.py b/rsa/pkcs1.py index 3837a69..ec6998e 100644 --- a/rsa/pkcs1.py +++ b/rsa/pkcs1.py @@ -57,6 +57,7 @@ HASH_METHODS: typing.Dict[str, typing.Callable[[], HashType]] = { "SHA-384": hashlib.sha384, "SHA-512": hashlib.sha512, } +"""Hash methods supported by this library.""" if sys.version_info >= (3, 6): @@ -423,7 +424,7 @@ def compute_hash(message: typing.Union[bytes, typing.BinaryIO], method_name: str object. If ``message`` has a ``read()`` method, it is assumed to be a file-like object. :param method_name: the hash method, must be a key of - :py:const:`HASH_METHODS`. + :py:const:`rsa.pkcs1.HASH_METHODS`. """ -- cgit v1.2.1