rbit / pydtls

Datagram Transport Layer Security for Python
Apache License 2.0
72 stars 45 forks source link

create a server with PSK support #22

Open lijia00 opened 6 years ago

lijia00 commented 6 years ago

Hi I am new to this library and SSL in general, apologize in advance. I've been trying to create a server using pydtls that will support PSK. I have a client that tries to establish a PSK connection, but whenever it tries to talk to my server, i just get an error of ssl3_get_client_hello:no shared cipher. How can i do this?

I have an existing client that uses Pydtls and establishes a connection with a server already using PSK so I assumed I should be able to make my own Server that can take connections using PSK cipher.

lijia00 commented 6 years ago

Is there some any restriction with pydtls to what cipher suites can be used? I can make successful connections to my server if i don't set ciphers = "PSK" in ssl.wrap_socket after calling do_patch(). But if I set ciphers="PSK" it fails, even though my client (also using pydtls) is requesting ciphers="PSK", and I can observe in wireshark that they are valid cipher suites. It seems there is a restriction on the server side when trying to use a cipher suite of PSK? I can tell it's something on the server side because if i tell the client to use "DEFAULT" cipher suite instead of PSK, it still fails on the server side when cipher="PSK". If i set them both to "DEFAULT" it works fine