Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'_RSAPrivateKey' object has no attribute 'sign' #611

Closed
peternye opened this issue Jul 27, 2021 · 10 comments
Closed

'_RSAPrivateKey' object has no attribute 'sign' #611

peternye opened this issue Jul 27, 2021 · 10 comments
Assignees
Labels

Comments

@peternye
Copy link

  • [x ] I have checked that the SDK documentation doesn't solve my issue.
  • [x ] I have checked that the API documentation doesn't solve my issue.
  • [ x] I have searched the Box Developer Forums and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
  • [ x] I have searched Issues in this repo and my issue isn't already reported.

Description of the Issue

When trying to access the folder structure from a Linux server, it sometimes succeeds, and sometimes I get:
File "/dist/shows/shared/lib/python2.7/site-packages/jwt/api_jws.py" in encode
114. signature = alg_obj.sign(signing_input, key)

File "/dist/shows/shared/lib/python2.7/site-packages/jwt/algorithms.py" in sign
313. return key.sign(msg, padding.PKCS1v15(), self.hash_alg())

Exception Type: AttributeError at /attachments/add/red/international/internationalizr/712768/
Exception Value: '_RSAPrivateKey' object has no attribute 'sign'

This seems to happen more often when the browser request to the server is coming from a Mac Big Sur. This doesn't make sense, since it is still the Linux server issuing the Box call.

Steps to Reproduce

rootFolder = self.client.folder(folder_id='0')
where self.client is the box client

Versions Used

Python SDK: 2.12.1
Python: 2.7.5

@mwwoda
Copy link
Contributor

mwwoda commented Jul 29, 2021

Hi @peternye

Which version of cryptography are you using? Can you run pip list and post the packages versions? You could try to upgrade cryptography as the problem could be related to that.

Thanks,
@mwwoda

@mwwoda
Copy link
Contributor

mwwoda commented Aug 4, 2021

Hi @peternye

Is it still an issue?

Thanks,
@mwwoda

@peternye
Copy link
Author

peternye commented Aug 4, 2021 via email

@mwwoda
Copy link
Contributor

mwwoda commented Aug 5, 2021

@peternye could you do the steps mentioned above?

Which version of cryptography are you using? Can you run pip list and post the packages versions? You could try to upgrade cryptography as the problem could be related to that.

@peternye
Copy link
Author

peternye commented Aug 5, 2021

Here are the versions we're using:

cryptography 1.7.2
jwcrypto 0.4.2
pycrypto 2.6.1

@mwwoda
Copy link
Contributor

mwwoda commented Aug 6, 2021

This issue could be related to the old cryptography version. Could you try to upgrade it to 3.x.x version? You can use the latests for python 2.7 which is 3.3.2.

@peternye
Copy link
Author

peternye commented Aug 12, 2021 via email

@peternye
Copy link
Author

peternye commented Aug 18, 2021

I upgraded to cryptography 3.3.2 and boxsdk 2.12.1. I'm now getting:
auth = JWTAuth.from_settings_file("/depts/tools/prodsoft/Sites/confs/box-config.json")
AttributeError: 'NoneType' object has no attribute 'from_settings_file'

@mwwoda
Copy link
Contributor

mwwoda commented Aug 19, 2021

This is probably the same issue as here #387. Refer to https://github.com/box/box-python-sdk#server-to-server-auth-with-jwt if you want to use JWT.

@peternye
Copy link
Author

peternye commented Aug 25, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants