abhishek-ram/django-pyas2

Error when sending/receiving files EVP_PKEY_size

Opened this issue · 1 comments

Environment:

Request Method: POST
Request URL: http://217.x.x.138:8084/pyas2/as2send/?partner_id=8xxxxxx

Django Version: 4.1.4
Python Version: 3.10.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pyas2']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
File "/home/bots/.local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/bots/.local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/bots/.local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/bots/.local/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/home/bots/.local/lib/python3.10/site-packages/django/views/generic/base.py", line 142, in dispatch
return handler(request, *args, **kwargs)
File "/home/bots/.local/lib/python3.10/site-packages/django/views/generic/edit.py", line 153, in post
return self.form_valid(form)
File "/home/bots/.local/lib/python3.10/site-packages/pyas2/views.py", line 225, in form_valid
as2message.build(
File "/home/bots/.local/lib/python3.10/site-packages/pyas2lib/as2.py", line 442, in build
signature_data = sign_message(
File "/home/bots/.local/lib/python3.10/site-packages/pyas2lib/cms.py", line 392, in sign_message
signature = asymmetric.rsa_pkcs1v15_sign(sign_key[0], data_to_sign, digest_alg)
File "/home/bots/.local/lib/python3.10/site-packages/oscrypto/_openssl/asymmetric.py", line 1494, in rsa_pkcs1v15_sign
return _sign(private_key, data, hash_algorithm)
File "/home/bots/.local/lib/python3.10/site-packages/oscrypto/_openssl/asymmetric.py", line 1809, in _sign
buffer_size = libcrypto.EVP_PKEY_size(private_key.evp_pkey)
File "/home/bots/.local/lib/python3.10/site-packages/cffi/api.py", line 912, in getattr
make_accessor(name)
File "/home/bots/.local/lib/python3.10/site-packages/cffi/api.py", line 908, in make_accessor
accessorsname
File "/home/bots/.local/lib/python3.10/site-packages/cffi/api.py", line 838, in accessor_function
value = backendlib.load_function(BType, name)

Exception Type: AttributeError at /pyas2/as2send/
Exception Value: function/symbol 'EVP_PKEY_size' not found in library 'libcrypto.so.3': /lib/x86_64-linux-gnu/libcrypto.so.3: undefined symbol: EVP_PKEY_size

I've encountered the same error.

Workaround
When you upgrade the oscrypto package to the newest version 1.3.0 this error disappears, but a new error appears, because it automatically upgrades the as1ncrypto package, which isn't compatible with the django-aspy2 package. If you downgrade the as1ncrypto package after the upgrade to version 1.4.0, it works.

oscrypto==1.3.0
as1ncrypto==1.4.0