def _credssp_processor(self, context):
http_response = (yield)<EOL>credssp_context = self._get_credssp_header(http_response)<EOL>if credssp_context is None:<EOL><INDENT>raise Exception('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if not credssp_context:<EOL><INDENT>self.tls_connection = SSL.Connection(self.tls_context)<EOL>self.tls_connection.set_connect_state()<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>self.tls_connection.do_handshake()<EOL><DEDENT>except SSL.WantReadError:<EOL><INDENT>http_response = yield self._set_credssp_header(http_response.request, self.tls_connection.bio_read(<NUM_LIT>))<EOL>credssp_context = self._get_credssp_header(http_response)<EOL>if credssp_context is None or not credssp_context:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>self.tls_connection.bio_write(credssp_context)<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>openssl_lib = _util.binding.lib<EOL>ffi = _util.binding.ffi<EOL>cipher = openssl_lib.SSL_get_current_cipher(self.tls_connection._ssl)<EOL>cipher_name = ffi.string( openssl_lib.SSL_CIPHER_get_name(cipher))<EOL>log.debug("<STR_LIT>", cipher_name)<EOL>context_generator = context.initialize_security_context()<EOL>negotiate_token = context_generator.send(None)<EOL>log.debug("<STR_LIT>", AsHex(negotiate_token))<EOL>ts_request = TSRequest()<EOL>ts_request['<STR_LIT>'] = negotiate_token<EOL>self.tls_connection.send(ts_request.getData())<EOL>http_response = yield self._set_credssp_header(http_response.request, self.tls_connection.bio_read(<NUM_LIT>))<EOL>authenticate_header = self._get_credssp_header(http_response)<EOL>if not authenticate_header or authenticate_header is None:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>self.tls_connection.bio_write(authenticate_header)<EOL>ts_request = TSRequest()<EOL>ts_request.fromString(self.tls_connection.recv(<NUM_LIT>))<EOL>challenge_token = ts_request['<STR_LIT>']<EOL>log.debug("<STR_LIT>", AsHex(challenge_token))<EOL>server_cert = self.tls_connection.get_peer_certificate()<EOL>public_key = HttpCredSSPAuth._get_rsa_public_key(server_cert)<EOL>ts_request = TSRequest()<EOL>type3= context_generator.send(challenge_token)<EOL>log.debug("<STR_LIT>", AsHex(type3))<EOL>ts_request['<STR_LIT>'] = type3<EOL>public_key_encrypted, signature = context.wrap_message(public_key)<EOL>ts_request['<STR_LIT>'] = signature + public_key_encrypted<EOL>self.tls_connection.send(ts_request.getData())<EOL>enc_type3 = self.tls_connection.bio_read(<NUM_LIT>)<EOL>http_response = yield self._set_credssp_header(http_response.request, enc_type3)<EOL>auth_response = self._get_credssp_header(http_response)<EOL>if not auth_response or auth_response is None:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>self.tls_connection.bio_write(auth_response)<EOL>ts_request = TSRequest()<EOL>ts_request.fromString(self.tls_connection.recv(<NUM_LIT>))<EOL>tsp = TSPasswordCreds()<EOL>tsp['<STR_LIT>'] = self.password_authenticator.get_domain()<EOL>tsp['<STR_LIT:username>'] = self.password_authenticator.get_username()<EOL>tsp['<STR_LIT:password>'] = self.password_authenticator.get_password()<EOL>tsc = TSCredentials()<EOL>tsc['<STR_LIT:type>'] = <NUM_LIT:1><EOL>tsc['<STR_LIT>'] = tsp.getData()<EOL>ts_request = TSRequest()<EOL>encrypted, signature = context.wrap_message(tsc.getData())<EOL>ts_request['<STR_LIT>'] = signature + encrypted<EOL>self.tls_connection.send(ts_request.getData())<EOL>token = self.tls_connection.bio_read(<NUM_LIT>)<EOL>http_response.request.body = self.body<EOL>http_response = yield self._set_credssp_header(self._encrypt(http_response.request, self.tls_connection), token)<EOL>if http_response.status_code == <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>
Implements a state machine
:return: