Closed il023109 closed 4 years ago
Thanks for the report.
What files are in C:\Python27\lib\site-packages\sslpsk\
?
Thanks for the response.
looks like the two DLLs are copied to C:\Python27\sslpsk, after I move them to C:\Python27\lib\site-packages\sslpsk\ everything works
I also submitted a PR for some typo in client example.
Interesting. I don't have a Windows machine, so it may be awhile before I can debug the installation process.
Hey there! I'm currently trying to use sslpsk to interface with a new Philips Hue API which is using a DTLS handshake and PSKs. I believe I'm running into the same issue or at least something related to what @il023109 has posted about.
I'm running Windows 10 and Python 2.7.
Here's the code I'm using to try and test a DTLS handshake:
do_patch() # PyDtls
s = socket(AF_INET, SOCK_DGRAM)
s.connect((BRIDGE_IP, STREAMING_PORT))
sock = sslpsk.wrap_socket(s,
psk=CLIENT_KEY,
hint=USERNAME,
ciphers='PSK-AES128-CBC-SHA')
sock.sendall('ping')
msg = sock.recv(4)
print 'Client received: %s' % msg
This will throw a Windows Application Error (0xC0000005) - Access Violation and crash Python.
When I dig into the Event Viewer logs, I'm told that this is the file that threw the error:
..\venv\lib\site-packages\sslpsk\SSLEAY32MD.dll
I think my install also had libeay32MD.dll
and ssleay32MD.dll
hanging out in a root /sslpsk
directory, but they were also present in ..\lib\site-packages\sslpsk
. I tried swapping those DLLs like @il023109 did, but same error.
Am I doing the socket code wrong, or does any of this give you any more insight into a possible issue? Thanks!
@kershner I've never tried DTLS with this library - that might not work at all, even on Linux. Can you try from a Linux VM, to see if your issues is actually Windows-specific?
Thanks for the response.
looks like the two DLLs are copied to C:\Python27\sslpsk, after I move them to C:\Python27\lib\site-packages\sslpsk\ everything works
I confirm this. Checked on Windows 10 with Python 2.7.13 and Python 2.7.16 (both 32bit). Dll were installed by pip into C:\Python27\sslpsk instead of C:\Python27\site-packages\sslpsk
@kershner Did you manage to find the solution? i am trying the same but i run into the same problem as you.
@drbild i tried this on an ubuntu vm but then i get the error "Segmentation fault (core dumped)" which is, if i understand correctly, the same as Windows Application Error (0xC0000005) - Access Violation, so i guess its not windows specific
Edit: Is it possible see what goes wrong inside SSLEAY32MD.dll? or is it impossible to know why it does this?
Interesting. I don't have a Windows machine, so it may be awhile before I can debug the installation process.
@drbild
The prebuilt DLLs that you are providing are in the wrong directory. I downloaded the wheel from https://pypi.org/project/sslpsk/#files. Then using 7zip, changed the DLLs location from sslpsk-1.0.0.data\data\sslpsk
to sslpsk-1.0.0.data\data\Lib\site-packages\sslpsk\
With this change it works.
@skboro Thanks. Do you know if that location changed between Python 2.6 and Python 2.7?
@skboro Thanks. Do you know if that location changed between Python 2.6 and Python 2.7?
Sorry. no idea about that. Will let you know if I find anything.
Python 2.7 system. pip install sslpsk import sslpsk failed.
C:\Python27>python psk_client.py Traceback (most recent call last): File "psk_client.py", line 3, in
import sslpsk
File "C:\Python27\lib\site-packages\sslpsk__init__.py", line 17, in
from sslpsk.sslpsk import wrap_socket
File "C:\Python27\lib\site-packages\sslpsk\sslpsk.py", line 21, in
from sslpsk import _sslpsk
ImportError: DLL load failed: The specified module could not be found.