Skip to content

Commit

Permalink
Encryption new signature svg pdf file
Browse files Browse the repository at this point in the history
  • Loading branch information
wincelau committed Jul 30, 2024
1 parent b4e883f commit a344b94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,16 @@ function($f3) {
array_map('unlink', explode(' ', trim($svgFiles)));
}

$symmetricKey = "";
if (isset($_COOKIE[$hash])) {
$symmetricKey = "#k:" . $_COOKIE[$hash];
$encryptor = new CryptographyClass($_COOKIE[$hash], $f3->get('PDF_STORAGE_PATH').$hash);
$encryptor->encrypt();
}

\Flash::instance()->setKey('openModal', 'signed');

$f3->reroute($f3->get('REVERSE_PROXY_URL').'/signature/'.$f3->get('PARAMS.hash'));
$f3->reroute($f3->get('REVERSE_PROXY_URL').'/signature/'.$hash.$symmetricKey);
}
);

Expand Down
5 changes: 4 additions & 1 deletion lib/cryptography.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ private function getFiles($isGpg) {
$suffix = ".gpg";
}
$filesTab = glob($this->pathHash.'/*.pdf'.$suffix);
$filesTab[] = $this->pathHash."/filename.txt".$suffix;

if(file_exists($this->pathHash."/filename.txt".$suffix)) {
$filesTab[] = $this->pathHash."/filename.txt".$suffix;
}

return $filesTab;
}
Expand Down

0 comments on commit a344b94

Please sign in to comment.