“no shared cipher” error with python and OpenSSL

后端 未结 2 1077
失恋的感觉
失恋的感觉 2021-01-18 12:13

Server:

#!/usr/bin/env python

import SocketServer
import json
from OpenSSL import SSL
import os
import socket

TERMINATION_STRING = \"Done\"

CERTIFICATE_P         


        
2条回答
  •  隐瞒了意图╮
    2021-01-18 12:40

    One error is:

    data += self.request.recv(1024).encode('utf-8').strip
    

    that leads me to a

    TypeError: cannot concatenate 'str' and 'builtin_function_or_method' objects
    

    It should be:

    data += self.request.recv(1024).encode('utf-8').strip()
    

    That example works for me.

    Got cert: 
    Got cert: 
    

    Tested with Stock 10.04 Ubuntu server and packages installed from apt-get.

    python-openssl                    0.10-1
    openssl                           0.9.8k-7ubuntu8
    python                            2.6.5-0ubuntu1
    

    You should check your certificate/CA, or test server with some simple script that list some available ciphers: https://superuser.com/questions/109213/is-there-a-tool-that-can-test-what-ssl-tls-cipher-suites-a-particular-website-of

    Update 2:

    In order to exclude some issues with certificates you could generate some CA and server/client certificates like in http://acs.lbl.gov/~boverhof/openssl_certs.html

提交回复
热议问题