private function createSignature(&$json) 
    {
        $string = $this->appId . $this->method . $this->endpoint;
        
        if ($json) {
            $string .= $json;
        }
        
        if ($this->accessToken) {
            $string .= $this->accessToken;
        }
        
        $digest = hash("sha512", $string);
      
        $sign = "";
        $result = openssl_public_encrypt($digest, $sign, $this->secretKey, OPENSSL_PKCS1_OAEP_PADDING);

        if (!$result) {
            throw new EndpointException("Request signing failed");
        }
        
        return rawurlencode(base64_encode($sign));
    }