Skip to content

Commit c025a02

Browse files
authored
Merge pull request #325 from dajiaji/bump-to-v2_2_0
Bump up version to v2.2.0.
2 parents 224db70 + 5d32d32 commit c025a02

6 files changed

Lines changed: 68 additions & 51 deletions

File tree

CHANGES.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ Changes
44
Unreleased
55
----------
66

7+
Version 2.2.0
8+
-------------
9+
10+
Released 2023-01-01
11+
12+
- Add support for countersignatures. `#323 <https://github.com/dajiaji/python-cwt/pull/323>`__
13+
- Remove Python 3.7 from CI temporarilly. `#323 <https://github.com/dajiaji/python-cwt/pull/323>`__
14+
- Enhance COSE message validation. `#300 <https://github.com/dajiaji/python-cwt/pull/300>`__
15+
- Add test and sample for COSE-HPKE MAC. `#297 <https://github.com/dajiaji/python-cwt/pull/297>`__
16+
- Add Python 3.11 to CI. `#296 <https://github.com/dajiaji/python-cwt/pull/296>`__
17+
- Update dependencies.
18+
- Bump cbor2 from 5.4.6. `#302 <https://github.com/dajiaji/python-cwt/pull/302>`__
19+
- Update dev dependencies.
20+
- Bump tox to 4.1.2. `#323 <https://github.com/dajiaji/python-cwt/pull/323>`__
21+
- Bump pre-commit/isort to 5.11.3. `#311 <https://github.com/dajiaji/python-cwt/pull/311>`__
22+
- Bump pre-commit/black to 22.12.0. `#306 <https://github.com/dajiaji/python-cwt/pull/306>`__
23+
- Bump certifi to 2022.12.7. `#303 <https://github.com/dajiaji/python-cwt/pull/303>`__
24+
725
Version 2.1.0
826
-------------
927

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99

1010
Python CWT is a CBOR Web Token (CWT) and CBOR Object Signing and Encryption (COSE)
1111
implementation compliant with:
12+
- [RFC9052: CBOR Object Signing and Encryption (COSE): Structures and Process](https://www.rfc-editor.org/rfc/rfc9052.html)
13+
- [RFC9053: CBOR Object Signing and Encryption (COSE): Initial Algorithms](https://www.rfc-editor.org/rfc/rfc9053.html)
14+
- [RFC9338: CBOR Object Signing and Encryption (COSE): Countersignatures](https://www.rfc-editor.org/rfc/rfc9338.html)
1215
- [RFC8392: CWT (CBOR Web Token)](https://tools.ietf.org/html/rfc8392)
13-
- [RFC8152: COSE (CBOR Object Signing and Encryption)](https://tools.ietf.org/html/rfc8152)
1416
- and related various specifications. See [Referenced Specifications](#referenced-specifications).
1517

1618
It is designed to make users who already know about [JWS](https://tools.ietf.org/html/rfc7515)/[JWE](https://tools.ietf.org/html/rfc7516)/[JWT](https://tools.ietf.org/html/rfc7519)
@@ -1656,11 +1658,14 @@ See [Documentation](https://python-readthedocs.io/en/stable/algorithms.html).
16561658

16571659
Python CWT is (partially) compliant with following specifications:
16581660

1659-
- [RFC8152: CBOR Object Signing and Encryption (COSE)](https://tools.ietf.org/html/rfc8152)
1660-
- [RFC8230: Using RSA Algorithms with COSE Messages](https://tools.ietf.org/html/rfc8230)
1661-
- [RFC8392: CBOR Web Token (CWT)](https://tools.ietf.org/html/rfc8392)
1662-
- [RFC8747: Proof-of-Possession Key Semantics for CBOR Web Tokens (CWTs)](https://tools.ietf.org/html/rfc8747)
1661+
- [RFC9052: CBOR Object Signing and Encryption (COSE): Structures and Process](https://www.rfc-editor.org/rfc/rfc9052.html)
1662+
- [RFC9053: CBOR Object Signing and Encryption (COSE): Initial Algorithms](https://www.rfc-editor.org/rfc/rfc9053.html)
1663+
- [RFC9338: CBOR Object Signing and Encryption (COSE): Countersignatures](https://www.rfc-editor.org/rfc/rfc9338.html)
16631664
- [RFC8812: COSE and JOSE Registrations for Web Authentication (WebAuthn) Algorithms](https://tools.ietf.org/html/rfc8812)
1665+
- [RFC8747: Proof-of-Possession Key Semantics for CBOR Web Tokens (CWTs)](https://tools.ietf.org/html/rfc8747)
1666+
- [RFC8392: CWT (CBOR Web Token)](https://tools.ietf.org/html/rfc8392)
1667+
- [RFC8230: Using RSA Algorithms with COSE Messages](https://tools.ietf.org/html/rfc8230)
1668+
- [RFC8152: CBOR Object Signing and Encryption (COSE)](https://tools.ietf.org/html/rfc8152)
16641669
- [Electronic Health Certificate Specification](https://github.com/ehn-dcc-development/hcert-spec/blob/main/hcert_spec.md)
16651670
- [Technical Specifications for Digital Green Certificates Volume 1](https://ec.europa.eu/health/sites/default/files/ehealth/docs/digital-green-certificates_v1_en.pdf)
16661671

cwt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from .recipient import Recipient
1919
from .signer import Signer
2020

21-
__version__ = "2.1.0"
21+
__version__ = "2.2.0"
2222
__title__ = "cwt"
2323
__description__ = "A Python implementation of CWT/COSE"
2424
__url__ = "https://python-cwt.readthedocs.io"

docs/index.rst

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ Welcome to Python CWT
77
=====================
88

99
Python CWT is a CBOR Web Token (CWT) and CBOR Object Signing and Encryption (COSE)
10-
implementation compliant with:
11-
12-
- `RFC8392: CBOR Web Token (CWT)`_
13-
- `RFC8152: CBOR Object Signing and Encryption (COSE)`_
14-
- and related various specifications. See `Referenced Specifications`_.
15-
16-
It is designed to make users who already know about `JWS`_/`JWE`_/`JWT`_
17-
be able to use it in ease. Little knowledge of `CBOR`_/`COSE`_/`CWT`_
18-
is required to use it.
10+
implementation compliant with `various COSE related specifications`_.
1911

2012
You can install Python CWT with pip:
2113

@@ -26,16 +18,43 @@ You can install Python CWT with pip:
2618
2719
And then, you can use it as follows:
2820

29-
.. code-block:: pycon
21+
COSE API:
22+
23+
.. code-block:: python
24+
25+
from cwt import COSE, COSEKey
26+
27+
mac_key = COSEKey.generate_symmetric_key(alg="HS256", kid="01")
28+
29+
# The sender side:
30+
sender = COSE.new()
31+
encoded = sender.encode(
32+
b"Hello world!",
33+
mac_key,
34+
protected={"alg": "HS256"},
35+
unprotected={"kid": "01"},
36+
)
37+
38+
# The recipient side:
39+
recipient = COSE.new()
40+
assert b"Hello world!" == recipient.decode(encoded, mac_key)
41+
42+
CWT API:
43+
44+
.. code-block:: python
45+
46+
import cwt
47+
from cwt import COSEKey
48+
49+
mac_key = COSEKey.generate_symmetric_key(alg="HS256", kid="01")
50+
51+
# The sender side:
52+
token = encode({1: "coaps://as.example", 2: "dajiaji", 7: b"123"}, mac_key)
53+
54+
# The recipient side:
55+
decoded = decode(token, mac_key)
56+
# decoded == {1: 'coaps://as.example', 2: 'dajiaji', 7: b'123', 4: 1620088759, 5: 1620085159, 6: 1620085159}
3057
31-
>>> import cwt
32-
>>> from cwt import COSEKey
33-
>>> key = COSEKey.from_symmetric_key(alg="HS256")
34-
>>> token = cwt.encode({"iss": "coaps://as.example", "sub": "dajiaji", "cti": "123"}, key)
35-
>>> token.hex()
36-
'd18443a10105a05835a60172636f6170733a2f2f61732e6578616d706c65026764616a69616a690743313233041a60c6a60b051a60c697fb061a60c697fb582019d4a89e141e3a8805ba1c90d81a8a2dd8261464dce379d8af8044d1cc062258'
37-
>>> cwt.decode(token, key)
38-
{1: 'coaps://as.example', 2: 'dajiaji', 7: b'123', 4: 1620088759, 5: 1620085159, 6: 1620085159}
3958
4059
Index
4160
-----
@@ -47,15 +66,6 @@ Index
4766
api
4867
claims
4968
algorithms
50-
specs
5169
changes
5270

53-
.. _`RFC8392: CBOR Web Token (CWT)`: https://tools.ietf.org/html/rfc8392
54-
.. _`RFC8152: CBOR Object Signing and Encryption (COSE)`: https://tools.ietf.org/html/rfc8152
55-
.. _`CBOR`: https://tools.ietf.org/html/rfc7049
56-
.. _`COSE`: https://tools.ietf.org/html/rfc8152
57-
.. _`CWT`: https://tools.ietf.org/html/rfc8392
58-
.. _`JWS`: https://tools.ietf.org/html/rfc7515
59-
.. _`JWE`: https://tools.ietf.org/html/rfc7516
60-
.. _`JWT`: https://tools.ietf.org/html/rfc7519
61-
.. _`Referenced Specifications`: ./specs.html
71+
.. _`various COSE related specifications`: https://github.com/dajiaji/python-cwt#referenced-specifications

docs/specs.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "cwt"
7-
version = "2.1.0"
7+
version = "2.2.0"
88
description = "A Python implementation of CWT/COSE."
99
authors = ["Ajitomi Daisuke <dajiaji@gmail.com>"]
1010
license = "MIT"

0 commit comments

Comments
 (0)