Skip to content

Commit 5276cae

Browse files
committed
Document JWE
1 parent 236ec88 commit 5276cae

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Contents
2424
jws/index
2525
jwt/index
2626
jwk/index
27+
jwe/index
2728

2829

2930
APIs
@@ -35,6 +36,7 @@ APIs
3536
jws/api
3637
jwt/api
3738
jwk/api
39+
jwe/api
3840

3941

4042
Principles

docs/jwe/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
JWE API
3+
^^^^^^^
4+
5+
.. automodule:: jose.jwe
6+
:members:

docs/jwe/index.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
JSON Web Encryption
2+
===================
3+
4+
JSON Web Encryption (JWE) are used to encrypt a payload and represent it as a
5+
compact URL-safe string.
6+
7+
Supported Content Encryption Algorithms
8+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
The following algorithms are currently supported.
11+
12+
+------------------+------------------------------------------------+
13+
| Encryption Value | Encryption Algorithm, Mode, and Auth Tag |
14+
+==================+================================================+
15+
| A128CBC_HS256 | AES w/128 bit key in CBC mode w/SHA256 HMAC |
16+
+------------------+------------------------------------------------+
17+
| A192CBC_HS384 | AES w/128 bit key in CBC mode w/SHA256 HMAC |
18+
+------------------+------------------------------------------------+
19+
| A256CBC_HS512 | AES w/128 bit key in CBC mode w/SHA256 HMAC |
20+
+------------------+------------------------------------------------+
21+
| A128GCM | AES w/128 bit key in GCM mode and GCM auth tag |
22+
+------------------+------------------------------------------------+
23+
| A192GCM | AES w/192 bit key in GCM mode and GCM auth tag |
24+
+------------------+------------------------------------------------+
25+
| A256GCM | AES w/256 bit key in GCM mode and GCM auth tag |
26+
+------------------+------------------------------------------------+
27+
28+
Supported Key Management Algorithms
29+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
The following algorithms are currently supported.
32+
33+
+-----------------+------------------------------------------------+
34+
| Algorithm Value | Key Wrap Algorithm |
35+
+=================+================================================+
36+
| DIR | Direct (no key wrap) |
37+
+-----------------+------------------------------------------------+
38+
| RSA1_5 | RSAES with PKCS1 v1.5 |
39+
+-----------------+------------------------------------------------+
40+
| RSA_OAEP | RSAES OAEP using default parameters |
41+
+-----------------+------------------------------------------------+
42+
| RSA_OAEP_256 | RSAES OAEP using SHA-256 and MGF1 with SHA-256 |
43+
+-----------------+------------------------------------------------+
44+
| A128KW | AES Key Wrap with default IV using 128-bit key |
45+
+-----------------+------------------------------------------------+
46+
| A192KW m | AES Key Wrap with default IV using 192-bit key |
47+
+-----------------+------------------------------------------------+
48+
| A256KW | AES Key Wrap with default IV using 256-bit key |
49+
+-----------------+------------------------------------------------+
50+
51+
Examples
52+
^^^^^^^^
53+
54+
Encrypting Payloads
55+
-------------------
56+
57+
.. code:: python
58+
59+
>>> from jose import jwe
60+
>>> jwe.encrypt('Hello, World!', 'asecret128bitkey', algorithm='dir', encryption='A128GCM')
61+
'eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..McILMB3dYsNJSuhcDzQshA.OfX9H_mcUpHDeRM4IA.CcnTWqaqxNsjT4eCaUABSg'
62+
63+
64+
Decrypting Payloads
65+
--------------------------
66+
67+
.. code:: python
68+
69+
>>> from jose import jwe
70+
>>> jwe.decrypt('eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..McILMB3dYsNJSuhcDzQshA.OfX9H_mcUpHDeRM4IA.CcnTWqaqxNsjT4eCaUABSg', 'asecret128bitkey')
71+
'Hello, World!'

0 commit comments

Comments
 (0)