Skip to content

Commit

Permalink
fix: random crash for missing y coordinate
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalDR committed Feb 9, 2024
1 parent 7983fdb commit 8ad32e6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pymdoccbor/mso/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import cryptography
import logging

from pycose.keys import CoseKey, EC2Key
from pycose.keys import EC2Key
from pycose.messages import Sign1Message

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

self.object.key: CoseKey | None = None
self.object.key = None
self.public_key: cryptography.hazmat.backends.openssl.ec._EllipticCurvePublicKey = None
self.x509_certificates: list = []

Expand Down Expand Up @@ -130,9 +130,8 @@ def load_public_key(self) -> None:

key = EC2Key(
crv=settings.COSEKEY_HAZMAT_CRV_MAP[self.public_key.curve.name],
x=self.public_key.public_numbers().x.to_bytes(
settings.CRV_LEN_MAP[self.public_key.curve.name], 'big'
)
x=self.public_key.public_numbers().x.to_bytes(settings.CRV_LEN_MAP[self.public_key.curve.name], 'big'),
y=self.public_key.public_numbers().y.to_bytes(settings.CRV_LEN_MAP[self.public_key.curve.name], 'big')
)
self.object.key = key

Expand Down

0 comments on commit 8ad32e6

Please sign in to comment.