doutuichan2681 2019-07-01 14:54
浏览 209

时间戳openssl无法验证时间戳

I'im trying to complete the process for a timestamping request/verify procedure.

So step 1 create timestamp request.php

require_once "TrustedTimestamps.php"; //i'm using David Müller script to manage openssl trought php
$signature_filename="example.txt";
$sha256 = hash_file('sha256', 'example.jpg');
$tsa_url = "https://tsa.exampleserver/tsa";

$requestFile = TrustedTimestamps::createRequestfile($sha256,'sha256');
$signature = TrustedTimestamps::signRequestfile($requestFile, $tsa_url);
file_put_contents($signature_filename, base64_decode($signature["response_string"]));

Step 2 validate timestampe validate.php

require_once "TrustedTimestamps.php";
$signature_filename="example.txt";
$sha256 = hash_file('sha256', 'example.jpg');
$tsa_url = "https://tsa.exampleserver/tsa";
$tsa_cert_file="timestampcertificate.crt";
$response_time="1561989750"; //extracted from the response

$content_file=file_get_contents($signature_filename);
$base64_response_string=base64_encode($content_file);

TrustedTimestamps::validate($sha256, $base64_response_string, $response_time, $tsa_cert_file,'sha256');

Step 1 seems to work correctly, i receive a timestamping string that i'm able to verify as detached timestamping in the tsa server site (They have a webpage with a form to upload timestamp and original image ). I need to complete the verification process automatically, without the webpage. Step 2 returns always an error:

TS_VERIFY_CERT:certificate verify error:unable to get local issuer certificate,

It seems that i can't verify my token with the tsa certificate file. I get this file from the tsa server owner, they told me that it's the file in wich the timestamps are signed. They can't tell me more and i can't ask for assistance, so my question is why i can't verify that token?

the open ssl command i used to verify is that:

"openssl ts -verify -digest ".escapeshellarg($hash)." -sha256 -in ".escapeshellarg($responsefile)." -CAfile ".escapeshellarg($tsa_cert_file);

-CAfile is the key of the problem i think, but i'm a newbie about openssl and timestamping. In openssl documentation there are very few details and in many examples i have seen only one file for -CAfile. Maybe my mistake is to pass the certificate directly trought the verify method?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 CSS实现渐隐虚线边框
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题