Skip to content

Incompatible with cryptography 43.0.x module #147

Description

@pgarasz

Hi,

I've run into an issue with requests-ntlm 1.3.0 after upgrading libraries in a Python 3.11 env.

It seems the issue was caused by cryptography module upgraded to 43.0.1.
It was working fine on 42.0.5 and downgrading helped.

Here's part of Traceback:

  File "C:\envs\my-env\Lib\site-packages\requests\hooks.py", line 30, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\requests_ntlm\requests_ntlm.py", line 200, in response_hook
    return self.retry_using_http_NTLM_auth(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\requests_ntlm\requests_ntlm.py", line 178, in retry_using_http_NTLM_auth
    authenticate_message = base64.b64encode(client.step(val) or b"").decode()
                                            ^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\spnego\_ntlm.py", line 384, in step
    out_token = getattr(self, "_step_%s" % self.usage)(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\spnego\_ntlm.py", line 457, in _step_initiate
    auth_kwargs["encrypted_session_key"] = rc4k(key_exchange_key, self._session_key)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\spnego\_ntlm_raw\crypto.py", line 426, in rc4k
    return rc4init(k).update(d)
           ^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\spnego\_ntlm_raw\crypto.py", line 431, in rc4init
    return RC4Handle(k)
           ^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\spnego\_ntlm_raw\crypto.py", line 56, in __init__
    self._handle = cipher.encryptor()
                   ^^^^^^^^^^^^^^^^^^
  File "C:\envs\my-env\Lib\site-packages\cryptography\hazmat\primitives\ciphers\base.py", line 113, in encryptor
    return rust_openssl.ciphers.create_encryption_ctx(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptography.exceptions.UnsupportedAlgorithm: cipher RC4 in None mode is not supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions