pull/1/head
Andrey Kislyuk 2017-08-22 15:02:25 -07:00
parent 738b1664e7
commit 546cf1f82e
1 changed files with 3 additions and 2 deletions

View File

@ -40,14 +40,15 @@ Installation
Asymmetric key algorithms (RSA and ECDSA) Asymmetric key algorithms (RSA and ECDSA)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For asymmetric key algorithms, you should supply the private key as the ``key`` parameter to the ``HTTPSignatureAuth()`` For asymmetric key algorithms, you should supply the private key as the ``key`` parameter to the ``HTTPSignatureAuth()``
constructor as bytes in the PEM format. When verifying, the ``key_resolver()`` callback should provide the public key as constructor as bytes in the PEM format:
bytes in the PEM format as well:
.. code-block:: python .. code-block:: python
with open('key.pem', 'rb') as fh: with open('key.pem', 'rb') as fh:
requests.get(url, auth=HTTPSignatureAuth(algorithm="rsa-sha256", key=fh.read(), key_id=preshared_key_id)) requests.get(url, auth=HTTPSignatureAuth(algorithm="rsa-sha256", key=fh.read(), key_id=preshared_key_id))
When verifying, the ``key_resolver()`` callback should provide the public key as bytes in the PEM format as well:
Links Links
----- -----
* `IETF HTTP Signatures draft <https://tools.ietf.org/html/draft-cavage-http-signatures>`_ * `IETF HTTP Signatures draft <https://tools.ietf.org/html/draft-cavage-http-signatures>`_