コード例 #1
0
ファイル: SSL.py プロジェクト: johannesraff/gtta-scripts
    def set_socket(self, sock):
        """
        Set the Python socket to use for network communications.

        @type socket: socket.socket
        @param socket: Python socket data will be transmitted through.
        """
        if self._socket != None:
            raise ctSSLError('Error: a socket has already been set.')
        self._socket = sock
コード例 #2
0
ファイル: SSL.py プロジェクト: navtej/sslyze
    def set_socket(self, sock):
        """
        Set the Python socket to use for network communications.

        @type socket: socket.socket
        @param socket: Python socket data will be transmitted through.
        """
        if self._socket != None:
            raise ctSSLError("Error: a socket has already been set.")
        self._socket = sock
コード例 #3
0
ファイル: SSL_CTX.py プロジェクト: swissfondue/gtta-scripts
    def __init__(self, ssl_version='sslv23'):
        """
        Create a new SSL_CTX instance.

        @type ssl_version: str
        @param ssl_version: SSL protocol version to use. Should be 'sslv23',
        'sslv2', 'sslv3', 'tlsv1', 'tlsv1_1' or 'tlsv1_2'.

        @raise ctSSL.errors.ctSSLError: Could not create the SSL_CTX C struct
        (SSL_CTX_new() failed).
        """
        self._ssl_ctx_struct_p = None
        self._pem_passwd_cb = None

        if ssl_version == 'sslv23':
            ssl_version = libssl.SSLv23_method()
        elif ssl_version == 'sslv2':
            if features_not_available.SSL2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable('SSLv2 disabled.')
            ssl_version = libssl.SSLv2_method()
        elif ssl_version == 'sslv3':
            ssl_version = libssl.SSLv3_method()
        elif ssl_version == 'tlsv1':
            ssl_version = libssl.TLSv1_method()
        elif ssl_version == 'tlsv1_1':
            if features_not_available.TLS1_1_TLS1_2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable(
                    'TLS 1.1 is not supported by the'
                    ' version of the OpenSSL library that was loaded.'
                    ' Upgrade to 1.0.1 or later.')
            ssl_version = libssl.TLSv1_1_method()
        elif ssl_version == 'tlsv1_2':
            if features_not_available.TLS1_1_TLS1_2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable(
                    'TLS 1.2 is not supported by the'
                    ' version of the OpenSSL library that was loaded.'
                    ' Upgrade to 1.0.1 or later.')
            ssl_version = libssl.TLSv1_2_method()
        else:
            raise ctSSLError(
                'Incorrect SSL version. Could not create SSL_CTX.')

        self._ssl_ctx_struct_p = libssl.SSL_CTX_new(ssl_version)
コード例 #4
0
ファイル: SSL_CTX.py プロジェクト: pandeytanuj/sslyze
    def __init__(self, ssl_version='sslv23'):
        """
        Create a new SSL_CTX instance.

        @type ssl_version: str
        @param ssl_version: SSL protocol version to use. Should be 'sslv23',
        'sslv2', 'sslv3', 'tlsv1', 'tlsv1_1' or 'tlsv1_2'.

        @raise ctSSL.errors.ctSSLError: Could not create the SSL_CTX C struct
        (SSL_CTX_new() failed).
        """
        self._ssl_ctx_struct_p = None
        self._pem_passwd_cb = None
        
        if ssl_version == 'sslv23':
            ssl_version = libssl.SSLv23_method()
        elif ssl_version == 'sslv2':
            if features_not_available.SSL2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable('SSLv2 disabled.')
            ssl_version = libssl.SSLv2_method()
        elif ssl_version == 'sslv3':
            ssl_version = libssl.SSLv3_method()
        elif ssl_version == 'tlsv1':
            ssl_version = libssl.TLSv1_method()
        elif ssl_version == 'tlsv1_1':
            if features_not_available.TLS1_1_TLS1_2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable('TLS 1.1 is not supported by the'
                ' version of the OpenSSL library that was loaded.'
                ' Upgrade to 1.0.1 or later.')
            ssl_version = libssl.TLSv1_1_method()
        elif ssl_version == 'tlsv1_2':
            if features_not_available.TLS1_1_TLS1_2_NOT_AVAIL:
                raise ctSSLFeatureNotAvailable('TLS 1.2 is not supported by the'
                ' version of the OpenSSL library that was loaded.'
                ' Upgrade to 1.0.1 or later.')
            ssl_version = libssl.TLSv1_2_method()
        else:
            raise ctSSLError('Incorrect SSL version. Could not create SSL_CTX.')

        self._ssl_ctx_struct_p = libssl.SSL_CTX_new(ssl_version)