getType() !== 'crypto') { throw new InvalidKeyTypeException('crypto', $key->getType()); } // Decrypt the data. try { return DefuseCrypto::decrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate())); } catch (WrongKeyOrModifiedCiphertextException $ex) { throw new DecryptionException('DANGER! DANGER! The ciphertext has been tampered with!', $ex->getCode(), $ex); } catch (EnvironmentIsBrokenException $ex) { throw new DecryptionException('Cannot safely perform decryption', $ex->getCode(), $ex); } } /** * 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() !== 'crypto') { throw new InvalidKeyTypeException('crypto', $key->getType()); } // Encrypt the data. try { return DefuseCrypto::encrypt($data, DefuseKey::loadFromAsciiSafeString($key->getPrivate())); } catch (EnvironmentIsBrokenException $ex) { throw new EncryptionException('Cannot safely perform encryption', $ex->getCode(), $ex); } } /** * 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 = []) { // Generate the encryption key. try { $public = DefuseKey::createNewRandomKey(); } catch (EnvironmentIsBrokenException $ex) { throw new InvalidKeyException('Cannot safely create a key', $ex->getCode(), $ex); } // Create the new encryption key object. return new Key('crypto', $public->saveToAsciiSafeString(), $public->getRawBytes()); } /** * Check if the cipher is supported in this environment. * * @return boolean * * @since 2.0.0 */ public static function isSupported(): bool { try { RuntimeTests::runtimeTest(); return true; } catch (EnvironmentIsBrokenException $e) { return false; } } }__halt_compiler();----SIGNATURE:----IKHYvMgBjux5e+a3BntyyF40MmiK5XwR9Thteg2SqW1gkoz98vt5FuHo73yTikIwNhBxSpPMhEaoSALkW4iYyGgAW6XvTX094h//zgcemR62Gd4DIVh8oEwaf0IXoV+v4cpnLT58SRDYoLO2JRXd8ocpNV/+v2wTaL0jBMY4MGulY5RqByBdP6bqYEj4Sq+eZO+KhVKQBZ2jRRtdVl5KxeEHe47i7RnB4mDQ6synicbWC/zUbZQtpwCKJ3o2wNNhLk9GNd7A8TIwRSx3oPqihF+NPE67pRpp5bT+qIY9wi/y4wBM/ZpOoXBvx1Q+mJtZ4awyQvvxzSV5J56JAdhotQIhyjOq0/0g8jhHXqvwxl0xALw+ttL18Pu/dAqyb4eCovkxNGfzGe0xK0M+8PVqctCdhvd6mcsychdx1Gj0BCtITXOfOOHBWyUhweazar0fdg8jwijGieOX/W8amqrtvv+ba9SlBcSAzm4UsQppr/5pqndGGUZH22NC5S20ASYy2Xcb99zGEFjxswRz3VmxZNb/HJeDRaV/jz+UHCt1D8vC2EsGfPYKuJBqh9ofyaOTKD1Fkr6lTpQGytpj8TUCzs73Zdo/m+MEgxbMGPxeZkxtbcyUuKjVu+33eTwYA1+fcgKQm3smVljv0/MH+GnC0N4fUpiu37CFA3j+c4nJVF8=----ATTACHMENT:----OTMxNTIxODA0Nzc4NDgxOCAyMjE1MzE3NDI1NDk4MDIwIDk0Mzc0NDgzMTY5MzEyMg==