apiToken) { throw new AccessDeniedHttpException('Доступ запрещен'); } $this->api->apiParams = $this->apiParams; try { $document = $this->api->download($request->url, $token); exec(sprintf('cp %s %s.pdf', $document->tempFileName, $document->tempFileName)); exec(sprintf('cryptcp -sign -detached -der %s', $document->tempFileName . '.pdf')); $response = base64_encode($document->tempFileName . '.sgn'); $this->removeExistingDocumentService->removeExistingDocument($document); return $response; } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } } }