Skip to content

Commit

Permalink
Minimal fix to fix type checking for latest pycose (#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Dec 18, 2023
1 parent 7b3f22f commit 6a7b6f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/ccf/cose.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import argparse
import sys

from typing import Optional
from typing import Optional, Type

import base64
import cbor2 # type: ignore
import cbor2
import json
from datetime import datetime
import pycose.headers # type: ignore
from pycose.keys.ec2 import EC2Key # type: ignore
from pycose.keys.curves import P256, P384, P521 # type: ignore
from pycose.keys.curves import P256, P384, P521, CoseCurve # type: ignore
from pycose.keys.keyparam import EC2KpCurve, EC2KpX, EC2KpY, EC2KpD # type: ignore
from pycose.messages import Sign1Message # type: ignore
from cryptography.hazmat.primitives.asymmetric import ec
Expand Down Expand Up @@ -51,6 +51,7 @@ def from_cryptography_eckey_obj(ext_key) -> EC2Key:
priv_nums = None
pub_nums = ext_key.public_numbers()

curve: Type[CoseCurve]
if pub_nums.curve.name == "secp256r1":
curve = P256
elif pub_nums.curve.name == "secp384r1":
Expand Down

0 comments on commit 6a7b6f2

Please sign in to comment.