Skip to content

Commit

Permalink
Merge pull request #5 from strey223/RM-3579.1
Browse files Browse the repository at this point in the history
RM-3579.1
  • Loading branch information
nikserg authored Oct 5, 2021
2 parents 51dbb08 + 2239bd6 commit ad38c3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CryptoProCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ public static function verifyFileContent($fileContent)
public static function verifyFileContentDetached($fileSignContent, $fileToBeSignedContent)
{
$fileToBeSigned = tempnam(sys_get_temp_dir(), 'detach');
$fileSign .= $fileToBeSigned . '.sgn';
$fileSign = $fileToBeSigned . '.sgn';
file_put_contents($fileSign, $fileSignContent);
file_put_contents($fileToBeSigned, $fileToBeSignedContent);
try {
self::verifyFileDetached($fileSign, $fileToBeSigned);
self::verifyFileDetached($fileSign, $fileToBeSigned, sys_get_temp_dir());
} finally {
unlink($fileSign);
unlink($fileToBeSigned);
Expand Down Expand Up @@ -180,8 +180,8 @@ public static function verifyFileDetached($fileSign, $fileToBeSigned, $fileDir)
//Пример cryptcp.exe -verify y:\text.txt -detached -nochain -f y:\signature.sig -dir y:\
$shellCommand = 'yes "n" 2> '.self::getDevNull() . ' | ' . escapeshellarg(self::$cryptcpExec) . ' -vsignf -dir '
. escapeshellarg($fileDir) . ' '
. escapeshellarg($fileSign)
. ' -f ' . escapeshellarg($fileToBeSigned);
. escapeshellarg($fileToBeSigned)
. ' -f ' . escapeshellarg($fileSign);
$result = shell_exec($shellCommand);
if (strpos($result, "[ErrorCode: 0x00000000]") === false && strpos($result, "[ReturnCode: 0]") === false) {
preg_match('#\[ErrorCode: (.+)\]#', $result, $matches);
Expand Down

0 comments on commit ad38c3e

Please sign in to comment.