Вес цыкл закончился ошибкой
:
/opt/cprocsp/bin/amd64/cryptcp -creatcert -dn "CN=test" -cont '\\.\HDIMAGE\testcont'
CryptCP 5.0 (c) "КРИПТО-ПРО", 2002-2019.
Утилита командной строки для подписи и шифрования файлов.
Создание запроса...
Press keys...
[.........................................................................................................]
Crypto-Pro GOST R 34.10-2001 KC1 CSP requests new authentication properties for container
New password:
Confirm password:
Отправление запроса в ЦС...
Установка сертификата...
Message contains root certificate that is absent in your root store.
Субъект:CRYPTO-PRO Test Center 2, CRYPTO-PRO LLC, Moscow, RU,
support@cryptopro.ruДействителен с 27.05.2019 07:24:26 по 26.05.2024 07:34:05
Do you want to add it to Root store? [Y]es or [N]o: y
Adding certificate to Root store.
CPCSP: Warning: installing a root certificate with an unconfirmed thumbprint is a security risk. Do you want to install this certificate?
Subject: CRYPTO-PRO Test Center 2
Thumbprint (sha1): CD321B87FDABB503829F88DB68D893B59A7C5DD3
(o)OK, (c)Cancel
o
Crypto-Pro GOST R 34.10-2001 KC1 CSP requests password
Type password:
Сертификат был успешно установлен.
[ErrorCode: 0x00000000]
/opt/cprocsp/bin/amd64/csptest -absorb -certs -autoprov
Match: HDIMAGE\\testcont.000\8AC7
OK.
Total: SYS: 0,000 sec USR: 0,000 sec UTC: 0,020 sec
[ErrorCode: 0x00000000]
php -f /opt/cprocsp/src/phpcades/test_extension.php
Cannot find object or property. (0x80092004)TEST FAIL
Скрипт который выполняется у меня:
<?php
//Вспомогательные функции предварительной инициализации
function SetupStore($location, $name, $mode)
{
$store = new CPStore();
$store->Open($location, $name, $mode);
return $store;
}
function SetupCertificates($location, $name, $mode)
{
$store = SetupStore($location, $name, $mode);
$certs = $store->get_Certificates();
return $certs;
}
function SetupCertificate($location, $name, $mode,
$find_type, $query, $valid_only,
$number)
{
$certs = SetupCertificates($location, $name, $mode);
if(!is_null($find_type))
{
$certs = $certs->Find($find_type, $query, $valid_only);
return $certs->Item($number);
}
else
{
$cert = $certs->Item($number);
return $cert;
}
}
function test_CPSignedData_Sign_Verify()
{
try{
$content = "test content";
$address = "http://testca.cryptopro.ru/tsp/tsp.srf";
$cert = SetupCertificate(CURRENT_USER_STORE, "My", STORE_OPEN_READ_ONLY,
CERTIFICATE_FIND_SUBJECT_NAME, "Беляев Анатолий Анатольевич", 0,
1);
if(!$cert)
return "Certificate not found";
$signer = new CPSigner();
$signer->set_TSAAddress($address);
$signer->set_Certificate($cert);
$sd = new CPSignedData();
$sd->set_ContentEncoding(1);
$sd->set_Content(base64_encode($content));
// Второй параметр - тип подписи(1 = CADES_BES):
http://cpdn.cryptopro.ru...f7edbeeaf0be3d44c0b.html //Третий параметр detached - отделенная(true) или совмещенная (false)
$sm = $sd->SignCades($signer, 1, false, 0);
printf("Signature is:\n");
printf($sm);
printf("\n");
$sd->VerifyCades($sm, 1, false);
return 1;
}catch(Exception $e)
{
printf($e->getMessage());
}
}
if(test_CPSignedData_Sign_Verify() == 1)
{
printf("TEST OK\n");
}else
{
printf("TEST FAIL\n");
}
?>
Отредактировано пользователем 13 декабря 2019 г. 12:55:58(UTC)
| Причина: Не указана