From 6a7b6f20ab17b2f375a237a7aca3ee8646e9ade8 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Mon, 18 Dec 2023 11:18:05 +0000 Subject: [PATCH] Minimal fix to fix type checking for latest pycose (#5869) --- python/ccf/cose.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/ccf/cose.py b/python/ccf/cose.py index 76eff3d18d99..52590107c403 100644 --- a/python/ccf/cose.py +++ b/python/ccf/cose.py @@ -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 @@ -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":