Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'

steps:
- uses: actions/checkout@v2
Expand Down
58 changes: 41 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,52 @@ according to ISO 18013-5.
## Setup

````
pip install pymdoccbor
pip install pymdlmdoc
````

or

````
pip install git+https://github.com/peppelinux/pyMDOC-CBOR.git
pip install git+https://github.com/devisefutures/pyMDOC-CBOR.git@cert_arg
````

## Usage

### Issue an MDOC CBOR signed with HSM key

````
PID_DATA = {
"eu.europa.ec.eudiw.pid.1": {
"family_name": "Raffaello",
"given_name": "Mascetti",
"birth_date": "1922-03-13"
}
}

mdoci = MdocCborIssuer(
alg = 'ES256',
kid = "demo-kid",
hsm=True,
key_label="p256-1",
user_pin="1234",
lib_path="/etc/utimaco/libcs2_pkcs11.so",
slot_id=3
)

mdoc = mdoci.new(
doctype="eu.europa.ec.eudiw.pid.1",
data=PID_DATA,
cert_path="app/keys/IACAmDLRoot01.der" # DS certificate
)

````

### Issue an MDOC CBOR

`MdocCborIssuer` must be initialized with a private key.
The method `.new()` gets the user attributes, devicekeyinfo and doctype.

````
import os

from pymdoccbor.mdoc.issuer import MdocCborIssuer

PKEY = {
Expand All @@ -58,17 +85,12 @@ PKEY = {
}

PID_DATA = {
"eu.europa.ec.eudiw.pid.1": {
"family_name": "Raffaello",
"given_name": "Mascetti",
"birth_date": "1922-03-13",
"birth_place": "Rome",
"birth_country": "IT"
},
"eu.europa.ec.eudiw.pid.it.1": {
"tax_id_code": "TINIT-XXXXXXXXXXXXXXX"
"eu.europa.ec.eudiw.pid.1": {
"family_name": "Raffaello",
"given_name": "Mascetti",
"birth_date": "1922-03-13"
}
}
}

mdoci = MdocCborIssuer(
private_key=PKEY
Expand All @@ -78,16 +100,20 @@ mdoc = mdoci.new(
doctype="eu.europa.ec.eudiw.pid.1",
data=PID_DATA,
devicekeyinfo=PKEY # TODO
cert_path="/path/"
)

mdoc
>> returns a python dictionay

mdoc.dump()
>> returns mdoc MSO bytes

mdoci.dump()
>> returns mdoc bytes

mdoci.dumps()
>> returns AF Binary string representation
>> returns AF Binary mdoc string representation
````

### Issue an MSO alone
Expand Down Expand Up @@ -213,8 +239,6 @@ Other examples at [cbor official documentation](https://github.com/agronholm/cbo
#### CBOR Diagnostic representation

- [CBOR-DIAG-PY](https://github.com/chrysn/cbor-diag-py)
- [Authlete's CBOR diagnostic tools](https://nextdev-api.authlete.net/api/cbor)
- [Auth0 CBOR diagnostic tool](https://www.mdl.me/)

#### X.509 certificates and chains

Expand Down
67 changes: 0 additions & 67 deletions examples/it_data_model.py

This file was deleted.

2 changes: 1 addition & 1 deletion pymdoccbor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0"
__version__ = "0.5.4"
11 changes: 0 additions & 11 deletions pymdoccbor/mdoc/exceptions.py

This file was deleted.

Loading
Loading