@@ -168,7 +168,11 @@ public function decrypt(string $encryptedData): string
168168 * @param bool $humanReadableData whether to return base64 encoded data
169169 * @return array Sealed data
170170 */
171- public function seal (string $ plain_text , RSAParameters $ rSAParameters , bool $ humanReadableData = false ): array
171+ public function seal (
172+ string $ plain_text ,
173+ RSAParameters $ rSAParameters ,
174+ bool $ humanReadableData = false
175+ ): array
172176 {
173177 $ this ->generateIV ('aes-256-cbc ' );
174178
@@ -197,7 +201,8 @@ public function seal(string $plain_text, RSAParameters $rSAParameters, bool $hum
197201 * @param RSAParameters $rSAParameters
198202 * @return string Opened data
199203 */
200- public function open (string $ sealed_data , string $ ekeys , RSAParameters $ rSAParameters ): string
204+ public function open (string $ sealed_data , string $ ekeys , RSAParameters $ rSAParameters , string $ privateKeyPass ,
205+ string $ salt ): string
201206 {
202207 if (preg_match ('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/ ' , $ sealed_data )) {
203208 $ sealed_data = base64_decode ($ sealed_data );
@@ -216,7 +221,7 @@ public function open(string $sealed_data, string $ekeys, RSAParameters $rSAParam
216221 $ iv = substr ($ sealed_data , 0 , $ iv_len );
217222 $ encryptedData = substr ($ sealed_data , $ iv_len );
218223
219- openssl_open ($ encryptedData , $ open_data , $ ekeys , $ rSAParameters ->getPrivateKey (), 'aes-256-cbc ' , $ iv );
224+ openssl_open ($ encryptedData , $ open_data , $ ekeys , $ rSAParameters ->getPrivateKey (passphrase: $ privateKeyPass , salt: $ salt ), 'aes-256-cbc ' , $ iv );
220225
221226 return $ open_data ;
222227 }
0 commit comments