|
@@ -47,9 +47,9 @@ discard block |
|
|
block discarded – undo |
|
47
|
47
|
public static function signFile($file, $thumbprint, $toFile = null, $detached = false) |
|
48
|
48
|
{ |
|
49
|
49
|
$shellCommand = self::getCryptcpExec() . |
|
50
|
|
- ' -sign '.($detached ? '-detached' : '').' -thumbprint ' . $thumbprint . ' ' . $file . ' ' . $toFile; |
|
|
50
|
+ ' -sign ' . ($detached ? '-detached' : '') . ' -thumbprint ' . $thumbprint . ' ' . $file . ' ' . $toFile; |
|
51
|
51
|
if (self::$unsafeMode) { |
|
52
|
|
- $shellCommand = 'yes | '.$shellCommand; |
|
|
52
|
+ $shellCommand = 'yes | ' . $shellCommand; |
|
53
|
53
|
} |
|
54
|
54
|
$result = shell_exec($shellCommand); |
|
55
|
55
|
|
|
@@ -166,7 +166,7 @@ discard block |
|
|
block discarded – undo |
|
166
|
166
|
*/ |
|
167
|
167
|
public static function verifyFile($file) |
|
168
|
168
|
{ |
|
169
|
|
- $shellCommand = 'yes "n" 2> '.self::getDevNull().' | ' . escapeshellarg(self::$cryptcpExec) . ' -verify -verall ' . escapeshellarg($file); |
|
|
169
|
+ $shellCommand = 'yes "n" 2> ' . self::getDevNull() . ' | ' . escapeshellarg(self::$cryptcpExec) . ' -verify -verall ' . escapeshellarg($file); |
|
170
|
170
|
$result = shell_exec($shellCommand); |
|
171
|
171
|
if (strpos($result, "[ErrorCode: 0x00000000]") === false && strpos($result, "[ReturnCode: 0]") === false) { |
|
172
|
172
|
preg_match('#\[ErrorCode: (.+)\]#', $result, $matches); |
|
@@ -195,7 +195,7 @@ discard block |
|
|
block discarded – undo |
|
195
|
195
|
public static function verifyFileDetached($fileSign, $fileToBeSigned, $fileDir) |
|
196
|
196
|
{ |
|
197
|
197
|
//Пример cryptcp.exe -verify y:\text.txt -detached -nochain -f y:\signature.sig -dir y:\ |
|
198
|
|
- $shellCommand = 'yes "n" 2> '.self::getDevNull() . ' | ' . escapeshellarg(self::$cryptcpExec) . ' -vsignf -dir ' |
|
|
198
|
+ $shellCommand = 'yes "n" 2> ' . self::getDevNull() . ' | ' . escapeshellarg(self::$cryptcpExec) . ' -vsignf -dir ' |
|
199
|
199
|
. escapeshellarg($fileDir) . ' ' |
|
200
|
200
|
. escapeshellarg($fileToBeSigned) |
|
201
|
201
|
. ' -f ' . escapeshellarg($fileSign); |