Skip to content

Commit 9fe32bb

Browse files
authored
Merge pull request #5 from PascalDR/fix/random_crash
Fix random crash for missing y coordinate
2 parents 7983fdb + 8ad32e6 commit 9fe32bb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pymdoccbor/mso/verifier.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import cryptography
33
import logging
44

5-
from pycose.keys import CoseKey, EC2Key
5+
from pycose.keys import EC2Key
66
from pycose.messages import Sign1Message
77

88
from pymdoccbor.exceptions import (
@@ -52,7 +52,7 @@ def __init__(self, data: cbor2.CBORTag) -> None:
5252
f"MsoParser only supports raw bytes and list, a {type(data)} was provided"
5353
)
5454

55-
self.object.key: CoseKey | None = None
55+
self.object.key = None
5656
self.public_key: cryptography.hazmat.backends.openssl.ec._EllipticCurvePublicKey = None
5757
self.x509_certificates: list = []
5858

@@ -130,9 +130,8 @@ def load_public_key(self) -> None:
130130

131131
key = EC2Key(
132132
crv=settings.COSEKEY_HAZMAT_CRV_MAP[self.public_key.curve.name],
133-
x=self.public_key.public_numbers().x.to_bytes(
134-
settings.CRV_LEN_MAP[self.public_key.curve.name], 'big'
135-
)
133+
x=self.public_key.public_numbers().x.to_bytes(settings.CRV_LEN_MAP[self.public_key.curve.name], 'big'),
134+
y=self.public_key.public_numbers().y.to_bytes(settings.CRV_LEN_MAP[self.public_key.curve.name], 'big')
136135
)
137136
self.object.key = key
138137

0 commit comments

Comments
 (0)