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

Fails to import dlls which can't use TLS #7

Open
rkbennett opened this issue Jun 20, 2024 · 11 comments
Open

Fails to import dlls which can't use TLS #7

rkbennett opened this issue Jun 20, 2024 · 11 comments

Comments

@rkbennett
Copy link
Contributor

Specifically, cryptography.hazmat.bindings._rust.pyd does not allow for TLS, but pythonmemorymodule forces use of TLS, not sure what the solution would be here, but it isn't compatible.

@naksyn
Copy link
Owner

naksyn commented Jun 20, 2024

Hi, I was able to load _rust.pyd calling PyInit__rust using PythonMemoryModule.
immagine

The pyd has a TLS callback and it looks like it's correctly executed:
immagine

Can you elaborate on the issue you are facing?

@rkbennett
Copy link
Contributor Author

I'm using python 3.11 and the pyd you get when you pip install OpenSSL with dependencies

@rkbennett
Copy link
Contributor Author

I'll try to get a screenshot when I get back to my desk

@rkbennett
Copy link
Contributor Author

image

This is what I'm seeing when I try to do the dll = pythonmemorymodule.MemoryModule(data=buf debug=True)

@rkbennett
Copy link
Contributor Author

I've also tried importing it directly with _memimporter and it throws a different error

image

This one led me to do some searching and it appeared as though _rust wasn't meant to support TLS.

@naksyn
Copy link
Owner

naksyn commented Jun 20, 2024

I was able to load _rust.pyd using Python 3.10.8 and pythonmemorymodule_wininet in the Pyramid dev branch.
Give it a try and let me know if that goes through also for you

@rkbennett
Copy link
Contributor Author

I downloaded the pythonmemorymodule_wininet.zip file, extracted it and then imported it and tried again on python3.10.11 and still get the same error.

image

image

@naksyn
Copy link
Owner

naksyn commented Jun 20, 2024

I confirm that with version 3.10.10 and 3.10.8 you can successfully load the _rust.pyd contained in this archive

immagine

I don't know the nuances of _rust.pyd files compiled for other python versions. I usually stick with versions 3.10.x because that's what I tested the most.

@rkbennett
Copy link
Contributor Author

How did you obtain that version of _rust.pyd?

@naksyn
Copy link
Owner

naksyn commented Jun 24, 2024

it's a freezed dependency for paramiko from late 2022. Check the about.py file, It's the cryptography package version 37.0.4, you can download it directly from PyPi.

@rkbennett
Copy link
Contributor Author

Awesome, I'll take a look at that and give it a try

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