I need to create a Client / Server application to send files from clients to the server. I use simple ssl sockets for this and make sure with certificates.
ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_sock = ssl.wrap_socket(ms, keyfile=".../newCA/my_client.key", certfile=".../newCA/my_client.crt", server_side=0, cert_reqs=ssl.CERT_REQUIRED, ca_certs=".../newCA/CA/my-ca.crt" ) ssl_sock.connect((HOST, MPORT))
And server side:
msock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.ssl_sock = ssl.wrap_socket(msock, keyfile=".../newCA/my_server.key", certfile=".../newCA/my_server.crt", server_side=1, cert_reqs=ssl.CERT_REQUIRED, ca_certs=".../newCA/CA/my-ca.crt" ) self.ssl_sock.bind(('', self.PORT)) self.ssl_sock.listen(self.QUEUE_MAX)
The problem is this: when the client tries to connect to the server, for this it is necessary to enter the password for the private key for both: for the server and client sides.
- In Java, we need to set the System Property: javax.net.ssl.keyStorePassword = "", and it should be used automatically, but how is it used in Python? I cannot enter the password all the time when the client connects.
The problem is that my application: the client must use the already signed certificate, and the server must use the already signed certificate. I canβt change it. Both Serever and clients are long-lived applications, so we just launch them and we donβt need to look for them. But, as I understand it, Python does not provide statndard a way to automatically enter a password for a private key. Could there be other suggestions?
source share