@@ -168,7 +168,11 @@ public function decrypt(string $encryptedData): string
168
168
* @param bool $humanReadableData whether to return base64 encoded data
169
169
* @return array Sealed data
170
170
*/
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
172
176
{
173
177
$ this ->generateIV ('aes-256-cbc ' );
174
178
@@ -197,7 +201,8 @@ public function seal(string $plain_text, RSAParameters $rSAParameters, bool $hum
197
201
* @param RSAParameters $rSAParameters
198
202
* @return string Opened data
199
203
*/
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
201
206
{
202
207
if (preg_match ('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/ ' , $ sealed_data )) {
203
208
$ sealed_data = base64_decode ($ sealed_data );
@@ -216,7 +221,7 @@ public function open(string $sealed_data, string $ekeys, RSAParameters $rSAParam
216
221
$ iv = substr ($ sealed_data , 0 , $ iv_len );
217
222
$ encryptedData = substr ($ sealed_data , $ iv_len );
218
223
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 );
220
225
221
226
return $ open_data ;
222
227
}
0 commit comments