Skip to content

EU fork integration #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
39ab4fe
preprod version
LuisPereira23 Jul 1, 2024
b8f3bfe
Merge pull request #1 from niscy-eudiw/branch-preprod
LuisPereira23 Jul 1, 2024
ce8e898
initial update for revocation status lists
LuisPereira23 Oct 14, 2024
335c251
Merge pull request #1 from niscy-eudiw/branch-development
LuisPereira23 Jan 22, 2025
17723ee
Merge pull request #2 from niscy-eudiw/branch-preprod
LuisPereira23 Jan 22, 2025
963cc84
update status struct
LuisPereira23 Jan 23, 2025
142d556
add new attestations dc4eu support test
LuisPereira23 Jan 23, 2025
4e12bcf
update dict and list encode tag
LuisPereira23 Jan 28, 2025
fe83479
update PID 1.5 nationality
LuisPereira23 Feb 20, 2025
993a456
Merge pull request #2 from niscy-eudiw/branch-development
LuisPereira23 Mar 5, 2025
d46a5f7
Merge pull request #3 from niscy-eudiw/branch-preprod
LuisPereira23 Mar 5, 2025
c613407
fix: ci restore
PascalDR Mar 13, 2025
670bd33
fix: restore code
PascalDR Mar 13, 2025
8a37f52
tests: adapted tests
PascalDR Mar 13, 2025
86e7f7c
fix: install
PascalDR Mar 13, 2025
f2149e6
fix: try ubuntu 22
PascalDR Mar 13, 2025
c768740
fix: dependency
PascalDR Mar 13, 2025
6439edb
fix: typo
PascalDR Mar 13, 2025
db5b9c9
fix: updated python versions
PascalDR Mar 13, 2025
3104d19
Update pymdoccbor/mdoc/issuer.py
PascalDR Mar 14, 2025
8f10944
fix: private key handling
PascalDR Mar 14, 2025
bd2d133
fix: version
PascalDR Mar 14, 2025
719e3bf
fix: private key handling
PascalDR Mar 14, 2025
750f7b2
fix: readme
PascalDR Mar 14, 2025
07f692a
fix: readme
PascalDR Mar 14, 2025
4aff49a
fix: readme
PascalDR Mar 14, 2025
7694fe9
fix: readme
PascalDR Mar 14, 2025
4f17a86
fix: restored example
PascalDR Mar 14, 2025
c089290
fix: restored docstring and typing
PascalDR Mar 14, 2025
e661611
fix: error handling
PascalDR Mar 14, 2025
23e41c2
tests: restored tests
PascalDR Mar 14, 2025
6a432df
fix: restored specialized exceptions
PascalDR Mar 14, 2025
7e4737f
Update README.md
PascalDR Mar 17, 2025
58985b6
Apply suggestions from code review
peppelinux Mar 18, 2025
cffd8a0
Merge branch 'main' into fix/eu_integration
peppelinux Mar 18, 2025
1827086
Apply suggestions from code review
peppelinux Mar 18, 2025
8d3d2be
Apply suggestions from code review
peppelinux Mar 18, 2025
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
7 changes: 4 additions & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v2
Expand All @@ -30,7 +31,7 @@ jobs:
- name: Install system package
run: |
sudo apt update
sudo apt install python3-dev libssl-dev make automake gcc g++
sudo apt install python3-dev libssl-dev libffi-dev make automake gcc g++
- name: Install dependencies
run: |
python -m pip install --upgrade pip
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