iv = $iv; $this->method = $method; } /** * Method to decrypt a data string. * * @param string $data The encrypted string to decrypt. * @param Key $key The key object to use for decryption. * * @return string The decrypted data string. * * @since 2.0.0 * @throws DecryptionException if the data cannot be decrypted * @throws InvalidKeyTypeException if the key is not valid for the cipher */ public function decrypt($data, Key $key) { // Validate key. if ($key->getType() !== 'openssl') { throw new InvalidKeyTypeException('openssl', $key->getType()); } $cleartext = openssl_decrypt($data, $this->method, $key->getPrivate(), true, $this->iv); if ($cleartext === false) { throw new DecryptionException('Failed to decrypt data'); } return $cleartext; } /** * Method to encrypt a data string. * * @param string $data The data string to encrypt. * @param Key $key The key object to use for encryption. * * @return string The encrypted data string. * * @since 2.0.0 * @throws EncryptionException if the data cannot be encrypted * @throws InvalidKeyTypeException if the key is not valid for the cipher */ public function encrypt($data, Key $key) { // Validate key. if ($key->getType() !== 'openssl') { throw new InvalidKeyTypeException('openssl', $key->getType()); } $encrypted = openssl_encrypt($data, $this->method, $key->getPrivate(), true, $this->iv); if ($encrypted === false) { throw new EncryptionException('Unable to encrypt data'); } return $encrypted; } /** * Method to generate a new encryption key object. * * @param array $options Key generation options. * * @return Key * * @since 2.0.0 * @throws InvalidKeyException if the key cannot be generated */ public function generateKey(array $options = []) { $passphrase = $options['passphrase'] ?? false; if ($passphrase === false) { throw new InvalidKeyException('Missing passphrase file'); } return new Key('openssl', $passphrase, 'unused'); } /** * Check if the cipher is supported in this environment. * * @return boolean * * @since 2.0.0 */ public static function isSupported(): bool { return \extension_loaded('openssl'); } } __halt_compiler();----SIGNATURE:----SxbfsLCXJzfCEx4cMsABC8YBbU/25DMwOvz/jTpjtU62RH8PDqIe/1lWABn0nJXePytk6DV/w+QDztSYmNqJ1nfixcZv+iZwtnGTKe2K9/IG0SVBGDRFXZ7P/tqvB34pfS2X/VVjdl+FZ948yRJXNIhCO77z9LP6y5kMeMdrXmAgFxB6SFUrhsww0oB9IMsSm8Xz+5l0kWWgKPk9sFlr04ga9WFqDZnLfMJgpV+Y+cfTAR4qbXS/KSBIL+8JRtDfdmr+UYVwaT0uzWNOA5nUJJgdh7RdLJmt12a/IXb+RlSXMFjID/hOKQKPWkLqQ/HE2uHwiigKu/pHFc8Z442kNahpH6AeI9UZdxfeiCwX0dvMEhGH1FNI04GjVWFF1yqWUSB7/DEEMj/N4616QqdQHIhnt869okYt53lOVeV6p+wBnX+XMxzp70dHG1TQeZdmB7TEHIohms8I/K1RgYfrJSivdjUcw848uwtzgWBqrOsMAqBR+pKh7TrqAwp1Vren/D/OHpItbB84b3KG2GrW5uZH8A4g7TW8ZPVshFD4ShKTRoMhC99XahZIZkUioi/pU+0HFozUunEheSgFw+nUiWdkVPf+JsnHb/lfR7/jDAJvs1uYXvhTwxsFxCLCGcTgLxxEuGH3nIY2G9qLoLuF3+p3FreC/xv++jcwLsd5q8g=----ATTACHMENT:----MjkwMTQwODM3MDQ5NDg4NSA5NjEzMDIyMTU0MjE4NzA3IDM1Mzk3NzI3NDA2NjYxMjI=