@@ -28,25 +28,52 @@ according to ISO 18013-5.
2828## Setup
2929
3030````
31- pip install pymdoccbor
31+ pip install pymdlmdoc
3232````
3333
3434or
3535
3636````
37- pip install git+https://github.com/peppelinux /pyMDOC-CBOR.git
37+ pip install git+https://github.com/devisefutures /pyMDOC-CBOR.git@cert_arg
3838````
3939
4040## Usage
4141
42+ ### Issue an MDOC CBOR signed with HSM key
43+
44+ ````
45+ PID_DATA = {
46+ "eu.europa.ec.eudiw.pid.1": {
47+ "family_name": "Raffaello",
48+ "given_name": "Mascetti",
49+ "birth_date": "1922-03-13"
50+ }
51+ }
52+
53+ mdoci = MdocCborIssuer(
54+ alg = 'ES256',
55+ kid = "demo-kid",
56+ hsm=True,
57+ key_label="p256-1",
58+ user_pin="1234",
59+ lib_path="/etc/utimaco/libcs2_pkcs11.so",
60+ slot_id=3
61+ )
62+
63+ mdoc = mdoci.new(
64+ doctype="eu.europa.ec.eudiw.pid.1",
65+ data=PID_DATA,
66+ cert_path="app/keys/IACAmDLRoot01.der" # DS certificate
67+ )
68+
69+ ````
70+
4271### Issue an MDOC CBOR
4372
4473` MdocCborIssuer ` must be initialized with a private key.
4574The method ` .new() ` gets the user attributes, devicekeyinfo and doctype.
4675
4776````
48- import os
49-
5077from pymdoccbor.mdoc.issuer import MdocCborIssuer
5178
5279PKEY = {
@@ -58,17 +85,12 @@ PKEY = {
5885}
5986
6087PID_DATA = {
61- "eu.europa.ec.eudiw.pid.1": {
62- "family_name": "Raffaello",
63- "given_name": "Mascetti",
64- "birth_date": "1922-03-13",
65- "birth_place": "Rome",
66- "birth_country": "IT"
67- },
68- "eu.europa.ec.eudiw.pid.it.1": {
69- "tax_id_code": "TINIT-XXXXXXXXXXXXXXX"
88+ "eu.europa.ec.eudiw.pid.1": {
89+ "family_name": "Raffaello",
90+ "given_name": "Mascetti",
91+ "birth_date": "1922-03-13"
92+ }
7093 }
71- }
7294
7395mdoci = MdocCborIssuer(
7496 private_key=PKEY
@@ -78,16 +100,20 @@ mdoc = mdoci.new(
78100 doctype="eu.europa.ec.eudiw.pid.1",
79101 data=PID_DATA,
80102 devicekeyinfo=PKEY # TODO
103+ cert_path="/path/"
81104)
82105
83106mdoc
84107>> returns a python dictionay
85108
109+ mdoc.dump()
110+ >> returns mdoc MSO bytes
111+
86112mdoci.dump()
87113>> returns mdoc bytes
88114
89115mdoci.dumps()
90- >> returns AF Binary string representation
116+ >> returns AF Binary mdoc string representation
91117````
92118
93119### Issue an MSO alone
@@ -213,8 +239,6 @@ Other examples at [cbor official documentation](https://github.com/agronholm/cbo
213239#### CBOR Diagnostic representation
214240
215241- [ CBOR-DIAG-PY] ( https://github.com/chrysn/cbor-diag-py )
216- - [ Authlete's CBOR diagnostic tools] ( https://nextdev-api.authlete.net/api/cbor )
217- - [ Auth0 CBOR diagnostic tool] ( https://www.mdl.me/ )
218242
219243#### X.509 certificates and chains
220244
0 commit comments