How I fixed tuya-convert Nous A1 could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher
Problem:
While trying to flash a device using tuya-convert, you see an error message like
Traceback (most recent call last):
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 6, in <module>
import sslpsk
ModuleNotFoundError: No module named 'sslpsk'
Traceback (most recent call last):
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 6, in <module>
import sslpsk
ModuleNotFoundError: No module named 'sslpsk'
new client on port 443 from 10.42.42.10:49144
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49150
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49154
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49156
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49160
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49162
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49164
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49172
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49174
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49176
could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:1123)
don't panic this is probably just your phone!
new client on port 443 from 10.42.42.10:49178
could not establish sslpsk socket: EOF occurred in violation of protocol (_ssl.c:1123)
Traceback (most recent call last):
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 61, in new_client
ssl_sock = sslpsk.wrap_socket(s1,
File "/usr/local/lib/python3.9/dist-packages/sslpsk/sslpsk.py", line 110, in wrap_socket
sock.do_handshake()
File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 113, in <module>
main()
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 109, in main
p.data_ready_cb(s)
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 80, in data_ready_cb
self.new_client(_s)
File "/home/pi/tuya-convert/scripts/./psk-frontend.py", line 72, in new_client
if "NO_SHARED_CIPHER" in e.reason or "WRONG_VERSION_NUMBER" in e.reason or "WRONG_SSL_VERSION" in e.reason:
TypeError: argument of type 'NoneType' is not iterable
and the flash procedure fails.
Solution
The current version of ./install_reqs.sh
does not install the sslpsk
module correctly (the error message is somewhat hidden at the top of the log). Install it manually using
sudo -H python3 -m pip install --upgrade sslpsk