Forward data to SSH Agent and return data reply

@param string $data
@return data from SSH Agent
@access private
485990
function _forward_data($data)
    {
        if ($this->expected_bytes > 0) {
            $this->socket_buffer.= $data;
            $this->expected_bytes -= strlen($data);
        } else {
            $agent_data_bytes = current(unpack('N', $data));
            $current_data_bytes = strlen($data);
            $this->socket_buffer = $data;
            if ($current_data_bytes != $agent_data_bytes + 4) {
                $this->expected_bytes = ($agent_data_bytes + 4) - $current_data_bytes;
                return false;
            }
        }

        if (strlen($this->socket_buffer) != fwrite($this->fsock, $this->socket_buffer)) {
            user_error('Connection closed attempting to forward data to SSH agent');
        }

        $this->socket_buffer = '';
        $this->expected_bytes = 0;

        $agent_reply_bytes = current(unpack('N', fread($this->fsock, 4)));

        $agent_reply_data = fread($this->fsock, $agent_reply_bytes);
        $agent_reply_data = current(unpack('a*', $agent_reply_data));

        return pack('Na*', $agent_reply_bytes, $agent_reply_data);
    }
127035
public function sendData($data)
    {
        $signer = new Signer($data);
        $signer->setIgnores(array('signature'));
        $content   = $signer->getContentToSign();
        $publicKey = $this->getPublicKey();

        if (! $this->getPublicKey()) {
            $publicKey = Signer::findPublicKey($data['certId'], $this->getCertDir());
        }

        $data['verify_success'] = $signer->verifyWithRSA($content, $data['signature'], $publicKey);

        $data['is_paid'] = $data['verify_success'] && ($this->getRequestParam('respCode') == '00');

        return $this->response = new ExpressCompletePurchaseResponse($this, $data);
    }
330407
public function fromRawData($data)
    {
        $secretLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $secretLength->getDataLength());

        $secretData = substr($data, 0, $secretLength->getValue());
        $data = substr($data, $secretLength->getValue());

        $verifyLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $verifyLength->getDataLength());

        $verifyData = substr($data, 0, $verifyLength->getValue());

        $this->setToken($verifyData)->setSecret($secretData);
    }
45161
public function sendData($data)
    {
        $response = $this->gocardless->payments()->cancel($this->getPaymentId());

        return $this->response = new PaymentResponse($this, $response);
    }
796437
public function decrypt($data)
    {
        try {
            return openssl_decrypt($data, self::$algorithm, self::$pass);
        } catch (\Exception $e) {
            return $data;
        }
    }
1289712
public function sendData ( $data )
	{
		
		// Test-API SSL cert issue
		$this->setSslVerification();
		
		$jsonData = json_encode( array( 
				'payment' => $data 
		) );
		
		$this->httpClient->setBaseUrl( $this->getUrl() . $this->endpoint . $this->getPaymentMethod() . '/payment/' );
		$request = $this->httpClient->post( null, null, $jsonData );
		$request->setAuth( $this->getMerchantId(), $this->getApiKey() );
		$request->setHeader( 'Content-type', 'application/json' );
		$request->addHeader( 'Accept', 'application/xml' );
		
		try {
			$httpResponse = $request->send();
		} catch ( BadResponseException $e ) {
			$e->getResponse()->getBody(1); // ugly; but else ->xml() will fail
			return new PurchaseResponse( $this, $e->getResponse()->xml() );
		}
		
		return new PurchaseResponse( $this, $httpResponse->xml() );
	}
539827
public function sendData($data)
    {
        $response = $this->braintree->transaction()->refund($data['transactionReference'], $data['amount']);

        return $this->createResponse($response);
    }
970750
public function return_data($data){

        if (isset($data['errcode']) && $data['errcode'] > 0){
            $this->error = $data['errmsg'];
            return false;
        }else{
            return $data;
        }
    }
1170717
function _send_binary_packet($data) {
        if (feof($this->fsock)) {
            //user_error('connection closed prematurely', E_USER_NOTICE);
            return false;
        }

        if (defined('NET_SSH1_LOGGING')) {
            $temp = isset($this->protocol_flags[ord($data[0])]) ? $this->protocol_flags[ord($data[0])] : 'UNKNOWN';
            $this->protocol_flags_log[] = '-> ' . $temp .
                                          ' (' . round($stop - $start, 4) . 's)';
            if (NET_SSH1_LOGGING == NET_SSH1_LOG_COMPLEX) {
                $this->message_log[] = substr($data, 1);
            }
        }

        $length = strlen($data) + 4;

        $padding_length = 8 - ($length & 7);
        $padding = '';
        for ($i = 0; $i < $padding_length; $i++) {
            $padding.= chr(crypt_random(0, 255));
        }

        $data = $padding . $data;
        $data.= pack('N', $this->_crc($data));

        if ($this->crypto !== false) {
            $data = $this->crypto->encrypt($data);
        }

        $packet = pack('Na*', $length, $data);

        $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
        $result = strlen($packet) == fputs($this->fsock, $packet);
        $stop = strtok(microtime(), ' ') + strtok('');

        return $result;
    }
886422
private function sendGetLabelRequest($data) {
		switch($this->getMayor()) {
			case 1:
				return $this->getSoapClient()->getLabelDD($data);
			case 2:
			default:
				return $this->getSoapClient()->getLabel($data);
		}
	}
1070690
public function sendData($data)
    {
        $response = $this->braintree->customer()->create($data);

        return $this->response = new CustomerResponse($this, $response);
    }
194485
public function decrypt($data) {
        if (is_array($data)) return array_map([$this, __FUNCTION__], $data);
        $raw = base64_decode($data);
        openssl_public_decrypt($raw, $result, $this->key);
        return $result;
    }
1097427
public function make($data)
	{
		$payload = array_merge($this->payload, $data);
		return $this->auth->make($payload, $this->secretKey);
	}
787765
function send($data) {
        $ps  = [];
        $ret = 0;
        foreach ($data as $p) {
            $ps[] = strlen($p);
            $ps[] = $p;
        }
        $s = join("\n", $ps) . "\n\n";
        if ($this->debug) {
            echo '> ' . str_replace(["\r", "\n"], ['\r', '\n'], $s) . "\n";
        }
        try {
            while (true) {
                $ret = @fwrite($this->sock, $s);
                if ($ret === false || $ret === 0) {
                    $this->close();
                    throw new SSDBException('Connection lost');
                }
                $s = substr($s, $ret);
                if (strlen($s) == 0) {
                    break;
                }
                @fflush($this->sock);
            }
        } catch (\Exception $e) {
            $this->close();
            throw new SSDBException($e->getMessage());
        }

        return $ret;
    }
243163
public function sendData($data)
    {
        $url = sprintf('%s?%s', $this->getEndpoint(), http_build_query($this->getData()));

        $result = $this->httpClient->request('get', $url)->getBody();

        $xml = simplexml_load_string($result);
        $json = json_encode($xml);
        $data = json_decode($json, true);

        return $this->response = new LegacyRefundNoPwdResponse($this, $data);
    }
1212622
public function sendData($data)
    {
        $data = parent::sendData($data);

        return $this->response = new AopTradeCancelResponse($this, $data);
    }
1315373
public function sendData($data)
    {
        $url = sprintf('%s?%s', $this->getEndpoint(), http_build_query($data));

        $response = $this->httpClient->request('GET', $url, [])->getBody();

        $data = [
            'result' => $response
        ];

        return $this->response = new VerifyNotifyIdResponse($this, $data);
    }