mirror of https://github.com/Yubico/python-fido2
Bump minimum dependency versions.
This commit is contained in:
parent
30ee871c3a
commit
77b7fb6990
|
@ -30,14 +30,9 @@ from __future__ import annotations
|
|||
from .utils import bytes2int, int2bytes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import ec, rsa, padding
|
||||
from cryptography.hazmat.primitives.asymmetric import ec, rsa, padding, ed25519
|
||||
from typing import Sequence, Type, Mapping, Any, Union, TypeVar
|
||||
|
||||
try:
|
||||
from cryptography.hazmat.primitives.asymmetric import ed25519
|
||||
except ImportError: # EdDSA requires Cryptography >= 2.6.
|
||||
ed25519 = None # type: ignore
|
||||
|
||||
|
||||
class CoseKey(dict):
|
||||
"""A COSE formatted public key.
|
||||
|
@ -75,9 +70,6 @@ class CoseKey(dict):
|
|||
:param alg: The COSE identifier of the algorithm.
|
||||
:return: A CoseKey.
|
||||
"""
|
||||
if alg == EdDSA.ALGORITHM and ed25519 is None:
|
||||
# EdDSA requires Cryptography >= 2.6.
|
||||
return UnsupportedKey
|
||||
for cls in CoseKey.__subclasses__():
|
||||
if cls.ALGORITHM == alg:
|
||||
return cls
|
||||
|
@ -106,10 +98,7 @@ class CoseKey(dict):
|
|||
@staticmethod
|
||||
def supported_algorithms() -> Sequence[int]:
|
||||
"""Get a list of all supported algorithm identifiers"""
|
||||
if ed25519:
|
||||
algs: Sequence[Type[CoseKey]] = [ES256, EdDSA, ES384, ES512, PS256, RS256]
|
||||
else:
|
||||
algs = [ES256, ES384, ES512, PS256, RS256]
|
||||
algs: Sequence[Type[CoseKey]] = [ES256, EdDSA, ES384, ES512, PS256, RS256]
|
||||
return [cls.ALGORITHM for cls in algs]
|
||||
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ include = [
|
|||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
cryptography = ">=2.1, !=35, <39"
|
||||
pyscard = {version = "^1.9 || ^2.0.0", optional = true}
|
||||
cryptography = ">=2.6, !=35, <39"
|
||||
pyscard = {version = "^1.9 || ^2", optional = true}
|
||||
|
||||
[tool.poetry.extras]
|
||||
pcsc = ["pyscard"]
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = "^6.0"
|
||||
pytest = "^7.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
|
|
@ -30,8 +30,6 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from fido2 import cbor
|
||||
from fido2.cose import CoseKey, ES256, RS256, EdDSA, UnsupportedKey
|
||||
from cryptography import __version__ as cryptography_version
|
||||
from distutils.version import LooseVersion
|
||||
from binascii import a2b_hex
|
||||
|
||||
import unittest
|
||||
|
@ -101,9 +99,6 @@ class TestCoseKey(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_EdDSA_parse_verify(self):
|
||||
if LooseVersion(cryptography_version) < LooseVersion("2.6"):
|
||||
self.skipTest("EdDSA support missing")
|
||||
|
||||
key = CoseKey.parse(cbor.decode(_EdDSA_KEY))
|
||||
self.assertIsInstance(key, EdDSA)
|
||||
self.assertEqual(
|
||||
|
|
Loading…
Reference in New Issue