From 199c2e5ebc025a1414c4a52601bcf4734f09cf72 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Wed, 14 Dec 2022 13:02:39 +0100 Subject: [PATCH] fix: cryptography dep and retrocompatibility --- requirements.txt | 2 +- spid_compliant_certificates/__init__.py | 2 +- .../validator/checks/custom_oid.py | 20 +++++-------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3bece69..b386668 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -cryptography==35.0.0 +cryptography>=35.0.0 iso3166==2.0.2 packaging==21.2 requests>=2.26.0 diff --git a/spid_compliant_certificates/__init__.py b/spid_compliant_certificates/__init__.py index c430604..aa35173 100644 --- a/spid_compliant_certificates/__init__.py +++ b/spid_compliant_certificates/__init__.py @@ -28,7 +28,7 @@ _min = 5 # micro version -_mic = 3 +_mic = 4 # release level (alpha, beta, rc, final) _rel = 'final' diff --git a/spid_compliant_certificates/validator/checks/custom_oid.py b/spid_compliant_certificates/validator/checks/custom_oid.py index fe942c7..b67bdc9 100644 --- a/spid_compliant_certificates/validator/checks/custom_oid.py +++ b/spid_compliant_certificates/validator/checks/custom_oid.py @@ -18,20 +18,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from cryptography import x509 +from cryptography.hazmat._oid import ObjectIdentifier -class CustomObjectIdentifier(x509.ObjectIdentifier): - def __init__(self, dotted_string: str, name: str) -> None: - super(CustomObjectIdentifier, self).__init__(dotted_string) - self.name = name - - @property - def _name(self) -> str: - return self.name - - -OID_INITIALS = CustomObjectIdentifier('2.5.4.43', 'initials') -OID_NAME = CustomObjectIdentifier('2.5.4.41', 'name') -OID_ORGANIZATION_IDENTIFIER = CustomObjectIdentifier('2.5.4.97', 'organizationIdentifier') # noqa -OID_URI = CustomObjectIdentifier('2.5.4.83', 'uri') +OID_INITIALS = ObjectIdentifier('2.5.4.43') +OID_NAME = ObjectIdentifier('2.5.4.41') +OID_ORGANIZATION_IDENTIFIER = ObjectIdentifier('2.5.4.97') # noqa +OID_URI = ObjectIdentifier('2.5.4.83')