Skip to content

Commit 9d7a9df

Browse files
committed
reinstate revocation parameter in MdocCborIssuer.new method
1 parent a1bec12 commit 9d7a9df

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

pymdoccbor/mdoc/issuer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def new(
7474
validity: dict = None,
7575
devicekeyinfo: Union[dict, CoseKey, str] = None,
7676
cert_path: str = None,
77-
status_list: dict = {},
77+
status_list: dict = None,
78+
revocation: dict = None
7879
):
7980
"""
8081
create a new mdoc with signed mso
@@ -85,6 +86,7 @@ def new(
8586
:param devicekeyinfo: Union[dict, CoseKey, str]: device key info
8687
:param cert_path: str: path to the certificate
8788
:param status_list: dict: The status list to include in the mso of the mdoc
89+
:param revocation: dict: The status list to include in the mso of the mdoc
8890
8991
:return: dict: signed mdoc
9092
"""
@@ -146,7 +148,8 @@ def new(
146148
alg=self.alg,
147149
kid=self.kid,
148150
validity=validity,
149-
status_list=status_list
151+
status_list=status_list,
152+
revocation=revocation
150153
)
151154

152155
else:
@@ -156,7 +159,8 @@ def new(
156159
alg=self.alg,
157160
cert_path=cert_path,
158161
validity=validity,
159-
status_list=status_list
162+
status_list=status_list,
163+
revocation=revocation
160164
)
161165

162166
mso = msoi.sign(doctype=doctype, device_key=devicekeyinfo,valid_from=datetime.datetime.now(datetime. UTC))

pymdoccbor/mso/issuer.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def __init__(
4343
hsm: bool = False,
4444
private_key: Union[dict, CoseKey] = None,
4545
digest_alg: str = settings.PYMDOC_HASHALG,
46-
status_list: dict = {}
46+
status_list: dict = None,
47+
revocation: dict = None
4748
) -> None:
4849
"""
4950
Initialize a new MsoIssuer
@@ -61,6 +62,7 @@ def __init__(
6162
:param private_key: Union[dict, CoseKey]: the signing key
6263
:param digest_alg: str: the digest algorithm
6364
:param status_list: dict: the status list to include in the mso
65+
:param revocation: dict: the status list to include in the mso
6466
"""
6567

6668
if not hsm:
@@ -96,6 +98,7 @@ def __init__(
9698
self.kid = kid
9799
self.validity = validity
98100
self.status_list = status_list
101+
self.revocation = revocation
99102

100103
alg_map = {"ES256": "sha256", "ES384": "sha384", "ES512": "sha512"}
101104

@@ -201,9 +204,12 @@ def sign(
201204
"deviceKeyInfo": {
202205
"deviceKey": device_key,
203206
},
204-
"digestAlgorithm": alg_map.get(self.alg),
205-
"status": self.status_list
207+
"digestAlgorithm": alg_map.get(self.alg)
206208
}
209+
if self.status_list is not None:
210+
payload.update({"status": self.status_list})
211+
if self.revocation is not None:
212+
payload.update({"status": self.revocation})
207213

208214
if self.cert_path:
209215
# Try to load the certificate file

0 commit comments

Comments
 (0)