AttributeError: '_RSAPrivateKey' object has no attribute 'sign' (Morango)
See original GitHub issueObserved behavior
Just built 0.7.0-beta5 and running it from the Debian, the setup process fails after completing the final step:
Expected behavior
Correctly create a key and quit.
User-facing consequences
Release blocker - or at least getting it explained is 😃
Errors and logs
INFO 2017-12-04 17:16:34,287 cli Going to daemon mode, logging to /var/kolibri/.kolibri/server.log
ERROR 2017-12-04 17:18:26,979 base Internal Server Error: /api/deviceprovision/
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/viewsets.py", line 87, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 466, in dispatch
response = self.handle_exception(exc)
File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/views.py", line 463, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/core/device/api.py", line 31, in create
data = serializer.save()
File "/usr/lib/python3/dist-packages/kolibri/dist/rest_framework/serializers.py", line 191, in save
self.instance = self.create(validated_data)
File "/usr/lib/python3/dist-packages/kolibri/core/device/serializers.py", line 57, in create
facility = Facility.objects.create(**validated_data.pop('facility'))
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 401, in create
obj.save(force_insert=True, using=self.db)
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 969, in save
super(Facility, self).save(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 706, in save
super(Collection, self).save(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/mptt/models.py", line 1001, in save
super(MPTTModel, self).save(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 163, in save
self.ensure_dataset()
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 975, in ensure_dataset
super(Facility, self).ensure_dataset(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 175, in ensure_dataset
inferred_dataset = self.infer_dataset(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 980, in infer_dataset
self.dataset = FacilityDataset.objects.create()
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/django/db/models/query.py", line 401, in create
obj.save(force_insert=True, using=self.db)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/models.py", line 279, in save
super(SyncableModel, self).save(*args, **kwargs)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/utils/uuids.py", line 117, in save
self.id = self.calculate_uuid()
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/models.py", line 324, in calculate_uuid
self._morango_source_id = self.calculate_source_id()
File "/usr/lib/python3/dist-packages/kolibri/auth/models.py", line 113, in calculate_source_id
self._morango_source_id = Certificate.generate_root_certificate("full-facility").id
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/certificates.py", line 81, in generate_root_certificate
cert.sign_certificate(cert)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/certificates.py", line 120, in sign_certificate
cert_to_sign.signature = self.sign(cert_to_sign.serialized)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/certificates.py", line 150, in sign
return self.private_key.sign(value)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/crypto.py", line 55, in sign
signature = self._sign(message)
File "/usr/lib/python3/dist-packages/kolibri/dist/morango/crypto.py", line 244, in _sign
return self._private_key.sign(message, crypto_padding.PKCS1v15(), crypto_hashes.SHA256())
AttributeError: '_RSAPrivateKey' object has no attribute 'sign'
kolibri shell
INFO Running Kolibri with the following settings: kolibri.deployment.default.settings.base
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import morango
>>> morango.__version__
'0.0.2'
>>> try:
... from M2Crypto import RSA as M2RSA
... from M2Crypto import BIO as M2BIO
... M2CRYPTO_EXISTS = True
... except:
... M2CRYPTO_EXISTS = False
...
>>> M2CRYPTO_EXISTS
False
>>> import cryptography
>>> cryptography.__file__
'/usr/lib/python3/dist-packages/cryptography/__init__.py'
>>> import cryptography
>>> cryptography.__version__
'1.2.3'
The C extensions are built…
$ ls /usr/lib/python3/dist-packages/kolibri/dist/cext/cp35/linux-x86_64/
asn1crypto cffi _cffi_backend.so cryptography idna pycparser pycparser-2.18.tar.gz six.py
Steps to reproduce
I can release/upload the .deb installer with the error if necessary…
Context
- Kolibri version: 0.7.0-beta5
- Operating system: Ubuntu 16.04
- Browser: ?
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Error in python cryptography module: _RSAPrivateKey' object ...
Then use that key to sign a message. But running the program throws AttributeError: '_RSAPrivateKey' object has no attribute 'sign'.
Read more >'_RSAPrivateKey' object has no attribute 'sign' - Deployment
... my django application with travis I got the following error when I ... (AttributeError): '_RSAPrivateKey' object has no attribute 'sign'.
Read more >'_RSAPrivateKey' object has no attribute 'encode'
What can cause this error while running the "Sample Program for the Python SDK" for the Snowpipe REST API : '_RSAPrivateKey' object has...
Read more >AttributeError: '_RSAPrivateKey' object has no attribute 'sign'
I am trying to create JWT token using python 2.7 and receive following error. AttributeError: '_RSAPrivateKey' object has no attribute 'sign' < ...
Read more >AttributeError: 'RsaKey' object has no attribute 'public_encrypt'
Oct 20 16:23:20 salt2 salt-master[15585]: [ERROR ] Future <salt.ext.tornado.concurrent.Future object at 0x7f0c9859d9d0> exception was never ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lyw07 I triggered a rebuild just 2 minutes ago 😃
No I don’t think it was added at that place due to any reason. It was probably because I didn’t know where to put it. Please feel free to change it! Thank you!