File: rfc7638.rst

package info (click to toggle)
python-authlib 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: python: 26,998; makefile: 53; sh: 14
file content (28 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
RFC7638: JSON Web Key (JWK) Thumbprint
======================================

.. versionadded:: v0.15

.. automodule:: authlib.jose

This RFC7638_ is used for computing a hash value over a JSON Web Key (JWK).
The value can be used as an identity of the JWK.

.. _RFC7638: https://tools.ietf.org/html/rfc7638

The ``.thumbprint`` method is defined on the ``Key`` class, you can use it
directly::

    from authlib.jose import JsonWebKey

    raw = read_file('rsa.pem')
    key = JsonWebKey.import_key(raw)

    key.thumbprint()

If a key has no ``kid``, you can add the value of ``.thumbprint()`` as a kid::

    key['kid'] = key.thumbprint()

This method is available on every Key class, including :class:`OctKey`,
:class:`RSAKey`, :class:`ECKey`, and :class:`OKPKey`.