Commit a47af83c authored by Simo Sorce's avatar Simo Sorce

The JOSE stanards have been approved

Replace all pointers to the drafts with pointers to the assigned RFC numbers.
Signed-off-by: default avatarSimo Sorce <simo@redhat.com>
parent 0ac5f17e
......@@ -2,12 +2,13 @@ JWCrypto
========
An implementation of the JOSE Working Group documents:
draft-ietf-jose-json-web-algorithms-40
draft-ietf-jose-json-web-encryption-40
draft-ietf-jose-json-web-key-41
draft-ietf-jose-json-web-signature-41
draft-ietf-oauth-json-web-token-32
draft-ietf-jose-cookbook-08
RFC 7515 - JSON Web Signature (JWS)
RFC 7516 - JSON Web Encryption (JWE)
RFC 7517 - JSON Web Key (JWK)
RFC 7518 - JSON Web Algorithms (JWA)
RFC 7519 - JSON Web Token (JWT)
RFC 7520 - Examples of Protecting Content Using JSON Object Signing and
Encryption (JOSE)
Documentation
=============
......
JSON Web Encryption (JWE)
=========================
The jwe Module implements the `JSON Web Encryption`_ draft (currently
version 40).
The jwe Module implements the `JSON Web Encryption`_ standard.
A JSON Web Encryption is represented by a JWE object, related utility
classes and functions are availbale in this module too.
.. _JSON Web Encryption: http://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-40
.. _JSON Web Encryption: https://tools.ietf.org/html/rfc7516
Classes
-------
......
JSON Web Key (JWK)
==================
The jwk Module implements the `JSON Web Key`_ draft (currently version 41).
The jwk Module implements the `JSON Web Key`_ standard.
A JSON Web Key is represented by a JWK object, related utility classes and
functions are availbale in this module too.
.. _JSON Web Key: http://tools.ietf.org/html/draft-ietf-jose-json-web-key-41
.. _JSON Web Key: http://tools.ietf.org/html/rfc7517
Classes
-------
......
JSON Web Signature (JWS)
========================
The jws Module implements the `JSON Web Signature`_ draft (currently
version 41).
The jws Module implements the `JSON Web Signature`_ standard.
A JSON Web Signature is represented by a JWS object, related utility
classes and functions are available in this module too.
.. _JSON Web Signature: http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41
.. _JSON Web Signature: http://tools.ietf.org/html/rfc7515
Classes
-------
......
JSON Web Token (JWT)
====================
The jwt Module implements the `JSON Web Token`_ draft (currently version
32).
The jwt Module implements the `JSON Web Token`_ standard.
A JSON Web Token is represented by a JWT object, related utility classes and
functions are availbale in this module too.
.. _JSON Web Token: http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32
.. _JSON Web Token: http://tools.ietf.org/html/rfc7519
Classes
-------
......
......@@ -5,7 +5,7 @@ import json
# Padding stripping versions as described in
# draft-ietf-jose-json-web-signature-41 appendix C
# RFC 7515 Appendix C
def base64url_encode(payload):
......
......@@ -14,7 +14,7 @@ import os
import zlib
# draft-ietf-jose-json-web-encryption-40 - 4.1
# RFC 7516 - 4.1
# name: (description, supported?)
JWEHeaderRegistry = {'alg': ('Algorithm', True),
'enc': ('Encryption Algorithm', True),
......@@ -285,7 +285,7 @@ class _aes_cbc_hmac_sha2(_raw_jwe):
m = h.finalize()
return m[:self.keysize]
# draft-ietf-jose-json-web-algorithms-40 - 5.2.2
# RFC 7518 - 5.2.2
def encrypt(self, k, a, m):
""" Encrypt accoriding to the selected encryption and hashing
functions.
......@@ -350,7 +350,7 @@ class _aes_gcm(_raw_jwe):
def key_size(self):
return self.keysize
# draft-ietf-jose-json-web-algorithms-40 - 5.2.2
# RFC 7518 - 5.3
def encrypt(self, k, a, m):
""" Encrypt accoriding to the selected encryption and hashing
functions.
......
......@@ -8,13 +8,13 @@ from jwcrypto.common import base64url_decode, base64url_encode
from jwcrypto.common import json_decode, json_encode
import os
# draft-ietf-jose-json-web-algorithms-24 - 7.4
# RFC 7518 - 7.4
JWKTypesRegistry = {'EC': 'Elliptic Curve',
'RSA': 'RSA',
'oct': 'Octet sequence'}
"""Registry of valid Key Types"""
# draft-ietf-jose-json-web-algorithms-24 - 7.5
# RFC 7518 - 7.5
# It is part of the JWK Parameters Registry, but we want a more
# specific map for internal usage
JWKValuesRegistry = {'EC': {'crv': ('Curve', 'Public'),
......@@ -44,18 +44,18 @@ JWKParamsRegistry = {'kty': ('Key Type', 'Public', ),
'Public')}
"""Regstry of valid key parameters"""
# draft-ietf-jose-json-web-algorithms-24 - 7.6
# RFC 7518 - 7.6
JWKEllipticCurveRegistry = {'P-256': 'P-256 curve',
'P-384': 'P-384 curve',
'P-521': 'P-521 curve'}
"""Registry of allowed Elliptic Curves"""
# draft-ietf-jose-json-web-key-41 - 8.2
# RFC 7517 - 8.2
JWKUseRegistry = {'sig': 'Digital Signature or MAC',
'enc': 'Encryption'}
"""Registry of allowed uses"""
# draft-ietf-jose-json-web-key-41 - 8.2
# RFC 7517 - 8.3
JWKOperationsRegistry = {'sign': 'Compute digital Signature or MAC',
'verify': 'Verify digital signature or MAC',
'encrypt': 'Encrypt content',
......
......@@ -13,7 +13,7 @@ from jwcrypto.common import json_decode, json_encode
from jwcrypto.jwk import JWK
# draft-ietf-jose-json-web-signature-41 - 9.1
# RFC 7515 - 9.1
# name: (description, supported?)
JWSHeaderRegistry = {'alg': ('Algorithm', True),
'jku': ('JWK Set URL', False),
......@@ -195,7 +195,7 @@ class JWSCore(object):
"""Core JWS token handling.
:param alg: The algorithm used to produce the signature.
See draft-ietf-jose-json-web-algorithms-24
See RFC 7518
:param key: A (:class:`jwcrypto.jwk.JWK`) key of appropriate
type for the "alg" provided in the 'protected' json string.
:param header: A JSON string representing the protected header.
......
......@@ -7,7 +7,7 @@ from jwcrypto import jws
from jwcrypto import jwe
import unittest
# Based on: draft-ietf-jose-cookbook-08
# Based on: RFC 7520
EC_Public_Key_3_1 = {
"kty": "EC",
......
......@@ -9,7 +9,7 @@ from jwcrypto import jwe
from jwcrypto import jwt
import unittest
# draft-ietf-jose-json-web-key-41 - A.1
# RFC 7517 - A.1
PublicKeys = {"keys": [
{"kty": "EC",
"crv": "P-256",
......@@ -29,7 +29,7 @@ PublicKeys = {"keys": [
"alg": "RS256",
"kid": "2011-04-29"}]}
# draft-ietf-jose-json-web-key-41 - A.2
# RFC 7517 - A.2
PrivateKeys = {"keys": [
{"kty": "EC",
"crv": "P-256",
......@@ -77,7 +77,7 @@ PrivateKeys = {"keys": [
"alg": "RS256",
"kid": "2011-04-29"}]}
# draft-ietf-jose-json-web-key-41 - A.3
# RFC 7517 - A.3
SymmetricKeys = {"keys": [
{"kty": "oct",
"alg": "A128KW",
......@@ -87,7 +87,7 @@ SymmetricKeys = {"keys": [
"5aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow",
"kid": "HMAC key used in JWS A.1 example"}]}
# draft-ietf-jose-json-web-key-41 - B
# RFC 7517 - B
Useofx5c = {"kty": "RSA",
"use": "sig",
"kid": "1b94c",
......@@ -120,7 +120,7 @@ Useofx5c = {"kty": "RSA",
"+N5MDtdPTEQ0XfIBc2cJEUyMTY5MPvACWpkA6SdS4xSvdXK3IVfOWA=="
]}
# draft-ietf-jose-json-web-key-41 - C.1
# RFC 7517 - C.1
RSAPrivateKey = {"kty": "RSA",
"kid": "juliet@capulet.lit",
"use": "enc",
......@@ -189,7 +189,7 @@ class TestJWK(unittest.TestCase):
jwk.JWK(generate='RSA', size=4096)
jwk.JWK(generate='EC', curve='P-521')
# draft-ietf-jose-json-web-signature-41 - A.1
# RFC 7515 - A.1
A1_protected = \
[123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32,
34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125]
......@@ -209,7 +209,7 @@ A1_example = {'key': SymmetricKeys['keys'][1],
'payload': bytes(bytearray(A1_payload)),
'signature': bytes(bytearray(A1_signature))}
# draft-ietf-jose-json-web-signature-41 - A.2
# RFC 7515 - A.2
A2_protected = \
[123, 34, 97, 108, 103, 34, 58, 34, 82, 83, 50, 53, 54, 34, 125]
A2_payload = A1_payload
......@@ -268,7 +268,7 @@ A2_example = {'key': A2_key,
'payload': bytes(bytearray(A2_payload)),
'signature': bytes(bytearray(A2_signature))}
# draft-ietf-jose-json-web-signature-41 - A.3
# RFC 7515 - A.3
A3_protected = \
[123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 50, 53, 54, 34, 125]
A3_payload = A2_payload
......@@ -292,7 +292,7 @@ A3_example = {'key': A3_key,
'signature': bytes(bytearray(A3_signature))}
# draft-ietf-jose-json-web-signature-41 - A.4
# RFC 7515 - A.4
A4_protected = \
[123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 53, 49, 50, 34, 125]
A4_payload = [80, 97, 121, 108, 111, 97, 100]
......@@ -323,7 +323,7 @@ A4_example = {'key': A4_key,
'signature': bytes(bytearray(A4_signature))}
# draft-ietf-jose-json-web-signature-41 - A.4
# RFC 7515 - A.4
A5_protected = 'eyJhbGciOiJub25lIn0'
A5_payload = A2_payload
A5_key = \
......@@ -651,7 +651,7 @@ class TestJWE(unittest.TestCase):
E.deserialize(E_A5_ex, E_A4_ex['key2'])
# draft-ietf-oauth-json-web-token-32
# RFC 7519
A1_header = {
"alg": "RSA1_5",
"enc": "A128CBC-HS256"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment