diff --git a/CryptoProCli.php b/CryptoProCli.php index 57efbb8..4fe947e 100644 --- a/CryptoProCli.php +++ b/CryptoProCli.php @@ -1,14 +1,16 @@ /dev/null | ' . self::$cryptcpExec . + $shellCommand = self::$cryptcpExec . ' -sign -thumbprint ' . $thumbprint . ' ' . $file . ' ' . $toFile; $result = shell_exec($shellCommand); - if (strpos($result, "Signed message is created.") <= 0) { - throw new \Exception('В ответе Cryptcp не найдена строка Signed message is created: ' . $result . ' команда ' . $shellCommand); + if (strpos($result, "Signed message is created.") <= 0 && strpos($result, + "Подписанное сообщение успешно создано") <= 0) { + throw new \Exception('В ответе Cryptcp не найдена строка "Signed message is created" или "Подписанное сообщение успешно создано": ' . $result . ' команда ' . $shellCommand); } } @@ -43,7 +46,7 @@ public static function signFile($file, $thumbprint, $toFile = null) */ public static function addSignToFile($file, $thumbprint) { - $shellCommand = 'yes "o" | ' . self::$cryptcpExec . + $shellCommand = self::$cryptcpExec . ' -addsign -thumbprint ' . $thumbprint . ' ' . $file; $result = shell_exec($shellCommand);