Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
24 changes: 20 additions & 4 deletions pymdoccbor/mso/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pycose.keys import CoseKey, EC2Key
from pycose.messages import Sign1Message

from typing import Union
from typing import Union, Any

from pymdoccbor.exceptions import (
MsoX509ChainNotFound,
Expand Down Expand Up @@ -75,15 +75,31 @@ def payload_as_dict(self):
)

@property
def raw_public_keys(self) -> bytes:
def raw_public_keys(self) -> list[Any]:
Comment thread
dariocast marked this conversation as resolved.
Outdated
"""
it returns the public key extract from x509 certificates
looking to both phdr and uhdr
Comment thread
dariocast marked this conversation as resolved.
Outdated
"""
_mixed_heads = self.object.phdr.items() | self.object.uhdr.items()
# _mixed_heads = self.object.phdr.items() | self.object.uhdr.items()
Comment thread
dariocast marked this conversation as resolved.
Outdated

merged = self.object.phdr.copy()
merged.update(self.object.uhdr)
_mixed_heads = merged.items()
for h, v in _mixed_heads:
if h.identifier == 33:
return list(self.object.uhdr.values())
# return list(self.object.uhdr.values())
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out code instead of leaving it in the codebase. This clutters the code and reduces readability.

Suggested change
# return list(self.object.uhdr.values())

Copilot uses AI. Check for mistakes.
if isinstance(v, bytes):
return [v]
elif isinstance(v, list):
return v
elif isinstance(v, dict):
return [v]
else:
logger.warning(
f"Unexpected type for public key: {type(v)}. "
"Expected bytes, list or dict."
)
continue

raise MsoX509ChainNotFound(
"I can't find any valid X509certs, identified by label number 33, "
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ isort
autoflake
bandit
autopep8
pycose>=1.0.1
pycose>=1.0.1
cbor2>=5.4.0,<5.5.0