forked from mpdavis/python-jose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Davis
committed
Jun 23, 2016
1 parent
9e4bbb2
commit 6dfedac
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
JWK API | ||
^^^^^^^ | ||
|
||
.. automodule:: jose.jwk | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
JSON Web Key | ||
============== | ||
|
||
JSON Web Keys (JWK) are a JSON data structure representing a cryptographic key. | ||
|
||
Examples | ||
^^^^^^^^ | ||
|
||
Verifying token signatures | ||
-------------------------- | ||
|
||
.. code:: python | ||
>>> from jose import jwk | ||
>>> | ||
>>> token = "eyJhbGciOiJIUzI1NiIsImtpZCI6IjAxOGMwYWU1LTRkOWItNDcxYi1iZmQ2LWVlZjMxNGJjNzAzNyJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.s0h6KThzkfBBBkLspW1h84VsJZFTsPPqMDA7g1Md7p0" | ||
>>> hmac_key = { | ||
"kty": "oct", | ||
"kid": "018c0ae5-4d9b-471b-bfd6-eef314bc7037", | ||
"use": "sig", | ||
"alg": "HS256", | ||
"k": "hJtXIZ2uSN5kbQfbtTNWbpdmhkV8FJG-Onbc6mxCcYg" | ||
} | ||
>>> | ||
>>> key = jwk.construct(key_data) | ||
>>> | ||
>>> key.verify(token) |