CBOR Object Signing and Encryption (COSE) implementation
Project description
pycose --- CBOR Object Signing and Encryption
This project is a Python implementation of the IETF CBOR Encoded Message Syntax (COSE). COSE has reached RFC status and is now available at RFC 8152.
Installation
$ pip install cose
WARNING: There is package on PyPI called pycose
which contains old code from this repository. Since I am not the maintainer I cannot update that package or remove it.
What is COSE ?
CBOR Encoded Message Syntax (COSE) is a data format for concise representation of small messages RFC 8152. COSE is optimized for low power devices. The messages can be encrypted, MAC'ed and signed. There are 6 different types of COSE messages:
- Encrypt0: An encrypted COSE message with a single recipient. The payload and AAD are protected by a shared CEK (Content Encryption Keys)
- Encrypt: An encrypted COSE message can have multiple recipients. For each recipient the CEK is encrypted with a KEK (Key Encryption Key) - using AES key wrap - and added to the message.
- MAC0: An authenticated COSE message with one recipient.
- MAC: An authenticated COSE message that can have multiple recipients. For each recipient, the authentication key is encrypted with a KEK and added to the message.
- Sign0: A signed COSE message with a single signature.
- Sign: A COSE message that has been signed by multiple entities (each signature is carried in a COSE signature structure, added to the message).
A basic COSE message consists of 2 information buckets and the payload:
- Protected header: This message field contains information that needs to be protected. This information is taken into account during the encryption, calculation of the MAC or the signature.
- Unprotected header: The information contained in the unprotected header is not protected by the cryptographic algorithms.
- Payload: Contains the payload of the message, protected (mac'ed, signed or encrypted) by the cryptographic algorithms.
Additionally, based on the message type, other message fields can be added:
- MAC or signature (for MAC0 or Sign1 messages)
- COSE recipients or COSE signatures (for MAC, Encrypt, and Sign messages)
Cryptography
The project depends on pyca/cryptography
for all cryptographic operations, except the deterministic ECDSA algorithm. For deterministic ECDSA pycose
uses python-ecdsa.
Documentation
More documentation on COSE an the pycose
API can be found at: https://pycose.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cose-0.9.dev1.tar.gz
.
File metadata
- Download URL: cose-0.9.dev1.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40482cec070dcbced8c62221a3beaed6d6293840d7ba03e4d88a281ce1a84ba2 |
|
MD5 | 98ee1ea139cb73b1475e620507dd5955 |
|
BLAKE2b-256 | ac5f499b3be66fec5921cdddd599691e948a9c90d570ba9cfba67e1f73fd2b53 |
File details
Details for the file cose-0.9.dev1-py3-none-any.whl
.
File metadata
- Download URL: cose-0.9.dev1-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d8ef41fe574b0ea5f25ac404f790135009b4af409d64d067bf1373105b52fae |
|
MD5 | 780022b7ebf42fab4c54a9da04811b9c |
|
BLAKE2b-256 | f0a1c1bd356e785715347294113254f92f9490ab16debcf097213dbdac3808df |