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

How to import OpenSSL.crypto correctly #177

Open
ProttayMondalAdhikari-eaton opened this issue Dec 11, 2024 · 1 comment
Open

How to import OpenSSL.crypto correctly #177

ProttayMondalAdhikari-eaton opened this issue Dec 11, 2024 · 1 comment

Comments

@ProttayMondalAdhikari-eaton
Copy link

ProttayMondalAdhikari-eaton commented Dec 11, 2024

I am getting the following error, when I try to compile my custom VEN.py code.

Traceback (most recent call last):
  File "/root/openleadr-python/./pma/VEN.py", line 3, in <module>
    from openleadr import OpenADRClient, enable_default_logging
  File "/usr/local/lib/python3.12/dist-packages/openleadr/__init__.py", line 20, in <module>
    from .client import OpenADRClient
  File "/usr/local/lib/python3.12/dist-packages/openleadr/client.py", line 27, in <module>
    from signxml.exceptions import InvalidSignature
  File "/usr/local/lib/python3.12/dist-packages/signxml/__init__.py", line 7, in <module>
    from .verifier import XMLVerifier, VerifyResult, SignatureConfiguration
  File "/usr/local/lib/python3.12/dist-packages/signxml/verifier.py", line 13, in <module>
    from OpenSSL.crypto import verify as openssl_verify
ImportError: cannot import name 'verify' from 'OpenSSL.crypto' (unknown location)

However, if I comment out the following
from OpenSSL.crypto import verify as openssl_verify
line from verifier.py, the code goes through

image

How do I properly source the OpenSSL.crypto library, so that the verify function can be added?

The first three lines are getting picked up. Even though they are from the same library.
image

What am I missing? I am just getting started with this repo.

@tonsmets
Copy link

tonsmets commented Jan 14, 2025

I have the same issue (tested on python 3.9, 3.10 and 3.11). I did some searching around and it seems the pyOpenSSL package version is the issue. When installing openleadr it installs version pyOpenSSL==23.0.0 (which is already quite old).

I found this thread that suggests updating to pyOpenSSL==24.2.1 and this seems to have resolved the issue for now.

Maybe we can hardcode this (minimum) pyOpenSSL version in https://github.com/OpenLEADR/openleadr-python/blob/main/setup.py?

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

No branches or pull requests

2 participants