title: EE certificate key too weak (_ssl.c:1131)
body: <p>I am using the python 3.8 client example on my Modbus application, but I get an error like this:</p>
  <pre><code>    self._sock = context.wrap_socket(self._sock, server_hostname=self._host)
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 500, in wrap_socket
      return self.sslsocket_class._create(
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 1040, in _create
      self.do_handshake()
    File &quot;/usr/lib/python3.8/ssl.py&quot;, line 1309, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1131)
  </code></pre>
  <p>I added the connection codes:</p>
  <pre><code> def _do_open(self):
          &quot;&quot;&quot;Connect to the Modbus slave&quot;&quot;&quot;
          if self._sock:
              self._sock.close()
          self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          self.set_timeout(self.get_timeout())
          self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          call_hooks(&quot;modbus_tcp.TcpMaster.before_connect&quot;, (self, ))
          context = SSLContext(ssl.PROTOCOL_TLS_CLIENT)
          # context.options |= ssl.OP_NO_SSLv3
          context.options |= ssl.OP_NO_TLSv1
          # context.options |= ssl.OP_NO_TLSv1_1
  
          context.load_verify_locations('cert.pem')
          context.check_hostname = False
          # context.verify_mode = ssl.CERT_NONE
          # with create_connection((self._host, self._port)) as self._sock:
          self._sock.connect((self._host, self._port))
          # time.sleep(4)
          # print(&quot;db:1&quot;)
          self._sock = context.wrap_socket(self._sock, server_hostname=self._host)
          #         # print(&quot;db:2&quot;)
          # call_hooks(&quot;modbus_tcp.TcpMaster.after_connect&quot;, (self, ))
  </code></pre>
  <p>If I added <code>context.verify_mode = ssl.CERT_NONE</code> line for the workaround, it works succefuly but it is not correct way. How Can I solve the problem ?</p>
  <p>This is Certificate and Key in Server; (Example key and cert which I found on the github)</p>
  <pre><code>const char *privkey = &quot;-----BEGIN PRIVATE KEY-----\n&quot;\
      &quot;MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAhD0FKNdH91c8Vis0\n&quot;\
      &quot;T7Pli3Grb+BM5xA1V/iNTGer5WSwJlAab6lJ6NNh7R15AXOO7XODOs58ikmEqgWi\n&quot;\
      &quot;wacQfwIDAQABAkAG4KeSirPO/OYB80hKtugC2xwX+vn08IZdt2sd5Kxvhzvmp9eM\n&quot;\
      &quot;F4QhlQLHOMrk5LkM7FF0G3FgZHlOAZAVbQTtAiEA6SOLWEpnCCEkkCLMmZTcwzV0\n&quot;\
      &quot;cX9c7ngnOF/xwIn8IT0CIQCRNJVZ3YcJoXFuOCdUid8qOqdatCDkV8TQNxXxPVSc\n&quot;\
      &quot;awIgR1fIMXl7NAKoZK8xeyIRuG7oNj8qWhNMtTSvDyNqk2UCIGgVWi0ldwN3Pviz\n&quot;\
      &quot;tbWKcnYxvv5sedtT8pcRtV/MB5drAiBZSqkW9Ha37EObdrctWBvBvHtUp8k9XOy6\n&quot;\
      &quot;1X0wxUy5BQ==\n&quot;\
      &quot;-----END PRIVATE KEY-----\n&quot;;
  
  const char *cert = &quot;-----BEGIN CERTIFICATE-----\n&quot;\
      &quot;MIIB2jCCAYSgAwIBAgIIU3U2E0/GMUowDQYJKoZIhvcNAQELBQAwGjEYMBYGA1UE\n&quot;\
      &quot;AwwPU3RyYWlnaHQgUm9vdENBMB4XDTIwMTExNTAwMDAwMFoXDTQwMTExNTAwMDAw\n&quot;\
      &quot;MFowGjEYMBYGA1UEAwwPU3RyYWlnaHQgU2VydmVyMFwwDQYJKoZIhvcNAQEBBQAD\n&quot;\
      &quot;SwAwSAJBAIQ9BSjXR/dXPFYrNE+z5Ytxq2/gTOcQNVf4jUxnq+VksCZQGm+pSejT\n&quot;\
      &quot;Ye0deQFzju1zgzrOfIpJhKoFosGnEH8CAwEAAaOBrTCBqjBJBgNVHSMEQjBAgBSD\n&quot;\
      &quot;hOKzs+3Mo56OeliOMM0gQZgafKEepBwwGjEYMBYGA1UEAwwPU3RyYWlnaHQgUm9v\n&quot;\
      &quot;dENBgghnEtSASbZ0HDAdBgNVHQ4EFgQUGroKNtRTXQ7nxeYSQlZq35oVQDQwDAYD\n&quot;\
      &quot;VR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcDATAbBgNVHREEFDASggZzZXJ2\n&quot;\
      &quot;ZXKCCHN0cmFpZ2h0MA0GCSqGSIb3DQEBCwUAA0EAO02jJwxokR4CeA8DDJqp/9Qk\n&quot;\
      &quot;0dim//+cjVTjxqIgUS5ykNW2CAIRuP5rVyzNv6U02F0q92Vs/754/ep+TyT70w==\n&quot;\
      &quot;-----END CERTIFICATE-----\n&quot;;
  </code></pre>