dotpot / InAppPy

Python In-app purchase validator for Apple AppStore and GooglePlay.
MIT License
207 stars 50 forks source link

[BUG] module 'OpenSSL.crypto' has no attribute 'sign' #92

Open lucaslcode opened 1 day ago

lucaslcode commented 1 day ago

I am using the cryptography package and inapppy in a project. https://cryptography.io/en/latest/changelog/#v44-0-0 has caused this error, I believe this is due to the dependency on oauth2lib which hasn't been updated since 2018

Stack trace:

...my code...
File "/usr/local/lib/python3.12/site-packages/inapppy/googleplay.py", line 210, in verify_with_result
result = self.check_purchase_subscription(purchase_token, product_sku, service)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/inapppy/googleplay.py", line 157, in check_purchase_subscription
result = subscriptions_get.execute(http=self.http)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/googleapiclient/http.py", line 923, in execute
resp, content = _retry_request(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/googleapiclient/http.py", line 191, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/oauth2client/transport.py", line 159, in new_request
credentials._refresh(orig_request_method)
File "/usr/local/lib/python3.12/site-packages/oauth2client/client.py", line 749, in _refresh
self._do_refresh_request(http)
File "/usr/local/lib/python3.12/site-packages/oauth2client/client.py", line 774, in _do_refresh_request
body = self._generate_refresh_request_body()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/oauth2client/client.py", line 1484, in _generate_refresh_request_body
assertion = self._generate_assertion()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/oauth2client/service_account.py", line 384, in _generate_assertion
return crypt.make_signed_jwt(self._signer, payload,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/oauth2client/crypt.py", line 97, in make_signed_jwt
signature = signer.sign(signing_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/oauth2client/_openssl_crypt.py", line 97, in sign
return crypto.sign(self._key, message, 'sha256')
^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/cryptography/utils.py", line 68, in __getattr__
obj = getattr(self._module, attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'OpenSSL.crypto' has no attribute 'sign'

Possible Fix

Freeze the cryptography package at 43.0.3

lucaslcode commented 19 hours ago

The fix was actually freezing pyopenssl==24.2.1