mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:21:59 +01:00
More TSA fixes
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
4a131f3058
commit
427114b892
@ -226,6 +226,7 @@ $config['TSA_URL'] = '';
|
||||
$config['TSA_PUBLIC_KEY_FILE'] = '';
|
||||
$config['TSA_START_ID'] = 1;
|
||||
$config['TSA_STAMP_REQUEST_UNIT_SIZE'] = 10000;
|
||||
$config['TSA_VERIFY_CERTIFICATE'] = true;
|
||||
|
||||
$config['DB_DRIVER'] = 'mysql';
|
||||
$config['DB_PREFIX'] = '';
|
||||
|
@ -82,9 +82,12 @@ if(MODE == 'time' && $data[COUNT] < 1) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$requestfile_path = TrustedTimestamps::createRequestfile($data[HASH_VALUE]);
|
||||
|
||||
$response = TrustedTimestamps::signRequestfile($requestfile_path, TSA_URL);
|
||||
try {
|
||||
$requestfile_path = TrustedTimestamps::createRequestfile($data[HASH_VALUE]);
|
||||
$response = TrustedTimestamps::signRequestfile($requestfile_path, TSA_URL);
|
||||
} catch(Exception $e) {
|
||||
die("Error: " . $e->getMessage() . "\n");
|
||||
}
|
||||
|
||||
$data[RESPONSE_STRING] = $response[RESPONSE_STRING];
|
||||
$data[RESPONSE_TIME] = $response[RESPONSE_TIME];
|
||||
|
@ -69,12 +69,17 @@ class TrustedTimestamps
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents($requestfile_path));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/timestamp-query'));
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TSA_VERIFY_CERTIFICATE);
|
||||
|
||||
$binary_response_string = curl_exec($ch);
|
||||
|
||||
$error = curl_error($ch);
|
||||
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($status != 200 || !strlen($binary_response_string))
|
||||
throw new Exception("The request failed");
|
||||
throw new Exception("The request failed. Status: $status, error: $error");
|
||||
|
||||
$base64_response_string = base64_encode($binary_response_string);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user