PHP与时间戳协议

PHP与时间戳协议,php,timestamp,rfc3161,Php,Timestamp,Rfc3161,在PHP中,我必须使用ARUBA作为CA,通过HTTP(RFC3161)使用时间戳协议签署文档 阿鲁巴的文件说: 要给数据加上时间戳,必须调用url 使用POST方法。在POST正文中,必须插入结构TimeStampReq(RFC 3161) 在DER中编码 如何使用php发出请求?您可以在php中使用curl函数 好的,这是我编辑/修改的tcpdf.php的一部分 //Send request to TSA Server with Curl

在PHP中,我必须使用ARUBA作为CA,通过HTTP(RFC3161)使用时间戳协议签署文档

阿鲁巴的文件说:

要给数据加上时间戳,必须调用url 使用POST方法。在POST正文中,必须插入结构TimeStampReq(RFC 3161) 在DER中编码


如何使用php发出请求?

您可以在php中使用curl函数

好的,这是我编辑/修改的tcpdf.php的一部分

                //Send request to TSA Server with Curl
            if(extension_loaded('curl')) {
                $hdaLog .= "\nCurl was already Loaded\nCurl is sending tsRequest to \"".$this->timestamp_url."\"";
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $this->timestamp_url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_USERAGENT, '1');
                curl_setopt($ch, CURLOPT_POSTFIELDS, $raw_data);

                $tsResponse = curl_exec($ch);
                if($tsResponse != false) {
                    $hdaLog .= "\ntsRequest is sent";
                } else {
                    hdaLog("$hdaLog\ncan't send tsRequest, Timestamp failed",'w');
                }
                //parse ts response
                $hexTs = bin2hex($tsResponse);
                $tsparse = asn1parse($hexTs);
                $tsparse0 = asn1parse($tsparse[0][1]);
                if(count($tsparse0 > 1)) { //Remove response status data, only take timeStampToken
                    $timeStamp = seq($tsparse0[1][1]);
                } else {
                    $timeStamp = seq($tsparse0[0][1]);
                }

                //Add timestamp to TCPDF Signature
                $timeStamp = seq("060B2A864886F70D010910020E".set($timeStamp));
                $pkcs7 = int($pa1[0][1]).seq($pa1[1][1]).seq($pa1[2][1]).explicit(0, $pa1[3][1]).seq($pa1[4][1]).oct($pa1[5][1]);
                $time = seq($pkcs7.explicit(1,$timeStamp));
                $aa=seq(int(1). set($p3[1][1]).seq($p3[2][1]).explicit(0, $p3[3][1]).set($time));
                $hdaSignature = seq("06092A864886F70D010702".explicit(0,($aa)))."0000";

                $signature = $hdaSignature;
                hdaLog("$hdaLog\nTimestamp Success");
            } else {
                $hdaLog .= "\nCurl was not loaded, trying to load it...";
                if(@dl('php_curl.dll')) {
                    $hdaLog .= "\nCurl successfully Loaded";
                } else {
                    hdaLog("$hdaLog\nCurl failed to load timestamping failed", 'w');
                }
            }

嘿,汤姆,你找到解决办法了吗?请与我们分享。请为您的答案提供一个示例或解释,以便其他读者了解什么是旋度函数。