Commit 161856fe by Mohammad Izzat Johari

refactor

parent 480a2526
...@@ -324,7 +324,7 @@ class Pkcs11Command ...@@ -324,7 +324,7 @@ class Pkcs11Command
public function decryptPkcs11($AttachmentFile) public function decryptPkcs11($AttachmentFile)
{ {
$id_key = $this->getkeypairIdByLabel($this->keyLabel); $id_key = $this->getkeypairIdByLabel($this->keyLabel);
$filename = $AttachmentFile->nama_fail; $filename = $AttachmentFile->name;
try { try {
// Decrypt AES Key first // Decrypt AES Key first
...@@ -360,7 +360,7 @@ class Pkcs11Command ...@@ -360,7 +360,7 @@ class Pkcs11Command
@unlink($decryptedKeyFile); @unlink($decryptedKeyFile);
// Decrypt the PDF content // Decrypt the PDF content
$encryptedPdf = file_get_contents($AttachmentFile->dir_file); $encryptedPdf = file_get_contents($AttachmentFile->pautan);
$iv = base64_decode($AttachmentFile->dir_iv); $iv = base64_decode($AttachmentFile->dir_iv);
$tag = base64_decode($AttachmentFile->dir_tag); $tag = base64_decode($AttachmentFile->dir_tag);
...@@ -383,12 +383,6 @@ class Pkcs11Command ...@@ -383,12 +383,6 @@ class Pkcs11Command
throw new \Exception('Failed to decrypt PDF content.'); throw new \Exception('Failed to decrypt PDF content.');
} }
// Save decrypted PDF
$decryptPath = public_path("storage/hsm/decrypt");
if (!File::exists($decryptPath)) {
File::makeDirectory($decryptPath, 0777, true);
}
$fpdi = new Fpdi(); $fpdi = new Fpdi();
// Write decrypted bytes to a memory stream // Write decrypted bytes to a memory stream
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment