Closed dinocherian closed 2 years ago
Used below library versions in centos 7 and issue got resolved after a long research. PyJWT was the issue creater
Package Version
adal 1.2.7 certifi 2021.10.8 cffi 1.15.0 charset-normalizer 2.0.12 cryptography 37.0.2 idna 3.3 pip 21.3.1 pycparser 2.21 PyJWT 1.7.1 python-dateutil 2.8.2 requests 2.27.1 setuptools 40.6.2 six 1.16.0 urllib3 1.26.9
Yeah, comparing the different of dependencies in your two behave-differently environments is the right way to troubleshoot. Glad that you figured it out.
It was somewhat strange that your environment used a recent version of cryptography but an older version of PyJWT. My guess is that cryptography's recent versions made some breaking changes that the older versions of PyJWT couldn't keep up with.
All is well that ends well. :-)
Facing errors related to "cryptography" library when execute adal script in CentOS 7 Python 3.6.12 for AD certificate authentication
used the test script given in this github repo as testscript in my environment. It is working perfectly in my windows python 3.6.12. But I am getting below error in CentOS python 3.6.12 where my application is running and require adal certificate authentication to AD.
Tried with different versions of cryptography library from https://pypi.org/project/cryptography/3.3/#files, but getting same error Could someone please guide me regarding which all versions of libraries should be used in CentOS 7 to make this work? Thanks in advance.
current versions of packages used in my local newLib folder ................................................................................................................................. Package Version
adal 1.2.7 certifi 2021.10.8 cffi 1.15.0 charset-normalizer 2.0.12 cryptography 36.0.2 cycler 0.11.0 idna 3.3 kiwisolver 1.3.1 logger 1.4 msal 1.17.0 numpy 1.19.5 Pillow 8.4.0 pip 21.3.1 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycparser 2.21 PyJWT 2.3.0 pyparsing 3.0.8 python-dateutil 2.8.2 requests 2.27.1 setuptools 40.6.2 six 1.16.0 urllib3 1.26.9
[root@cherid23]# python3 adal_test.py input.json Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib64/python3.6/hashlib.py", line 274, in func = get_hash(__func_name) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/hashlib.py", line 156, in get_openssl_constructor return get_builtin_constructor(name) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/hashlib.py", line 136, in get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 /content/collection/cmdscript/office365audit/newLib/jwt/utils.py:6: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release. from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve Traceback (most recent call last): File "adal_test.py", line 6, in from office365audit.newLib import adal File "/content/collection/cmdscript/office365audit/newLib/adal/init.py", line 34, in from .authentication_context import AuthenticationContext File "/content/collection/cmdscript/office365audit/newLib/adal/authentication_context.py", line 31, in from .authority import Authority File "/content/collection/cmdscript/office365audit/newLib/adal/authority.py", line 39, in from . import util File "/content/collection/cmdscript/office365audit/newLib/adal/util.py", line 35, in import adal File "/content/collection/cmdscript/office365audit/newLib/adal/init.py", line 34, in from .authentication_context import AuthenticationContext File "/content/collection/cmdscript/office365audit/newLib/adal/authentication_context.py", line 34, in from .token_request import TokenRequest File "/content/collection/cmdscript/office365audit/newLib/adal/token_request.py", line 34, in from . import self_signed_jwt File "/content/collection/cmdscript/office365audit/newLib/adal/self_signed_jwt.py", line 35, in import jwt File "/content/collection/cmdscript/office365audit/newLib/jwt/init.py", line 1, in from .api_jwk import PyJWK, PyJWKSet File "/content/collection/cmdscript/office365audit/newLib/jwt/api_jwk.py", line 3, in from .algorithms import get_default_algorithms File "/content/collection/cmdscript/office365audit/newLib/jwt/algorithms.py", line 6, in from .utils import ( File "/content/collection/cmdscript/office365audit/newLib/jwt/utils.py", line 6, in from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve File "/content/collection/cmdscript/office365audit/newLib/cryptography/hazmat/primitives/asymmetric/ec.py", line 13, in from cryptography.hazmat.primitives.asymmetric import ( File "/content/collection/cmdscript/office365audit/newLib/cryptography/hazmat/primitives/asymmetric/utils.py", line 6, in from cryptography.hazmat.bindings._rust import asn1 ImportError: cannot import name 'asn1'