python-websockets / websockets

Library for building WebSocket servers and clients in Python
https://websockets.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
5.07k stars 506 forks source link

PEM file use in secure websockets #1381

Closed alamathe1 closed 11 months ago

alamathe1 commented 12 months ago

More of a question that an issue.

Looking at one of your example on implementing a secure client and server, it is seen that the same localhost.pem file is distributed between the client and server. From a security standpoint, since client and the server and two separate entities, shouldn't their PEM file be different?

Example:

aaugustin commented 11 months ago

The point of these examples is just to show how to use an SSLContext. It doesn't aim at discussing best practices for managing TLS connections in general. I could add a sentence in the docs along the lines of "check Python's docs for best practices".