| @@ -1,0 +1,66 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikWP - Libraries | |
| 4 | + * @subpackage adapter.html | |
| 5 | + * @author E4J s.r.l. | |
| 6 | + * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved. | |
| 7 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +// No direct access | |
| 12 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 13 | + | |
| 14 | +JLoader::import('adapter.cipher.key'); | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Crypt cipher for encryption, decryption and key generation via the php-encryption library. | |
| 18 | + * | |
| 19 | + * @since 10.1.20 | |
| 20 | + */ | |
| 21 | +class JCryptCipherCrypto | |
| 22 | +{ | |
| 23 | + /** | |
| 24 | + * Method to decrypt a data string. | |
| 25 | + * | |
| 26 | + * @param string $data The encrypted string to decrypt. | |
| 27 | + * @param JCryptKey $key The key object to use for decryption. | |
| 28 | + * | |
| 29 | + * @return string The decrypted data string. | |
| 30 | + * | |
| 31 | + * @throws RuntimeException | |
| 32 | + */ | |
| 33 | + public function decrypt($data, JCryptKey $key) | |
| 34 | + { | |
| 35 | + throw new RuntimeException(sprintf('Missing %s implementation', __METHOD__), 501); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Method to encrypt a data string. | |
| 40 | + * | |
| 41 | + * @param string $data The data string to encrypt. | |
| 42 | + * @param JCryptKey $key The key object to use for encryption. | |
| 43 | + * | |
| 44 | + * @return string The encrypted data string. | |
| 45 | + * | |
| 46 | + * @throws RuntimeException | |
| 47 | + */ | |
| 48 | + public function encrypt($data, JCryptKey $key) | |
| 49 | + { | |
| 50 | + throw new RuntimeException(sprintf('Missing %s implementation', __METHOD__), 501); | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Method to generate a new encryption key object. | |
| 55 | + * | |
| 56 | + * @param array $options Key generation options. | |
| 57 | + * | |
| 58 | + * @return JCryptKey | |
| 59 | + * | |
| 60 | + * @throws RuntimeException | |
| 61 | + */ | |
| 62 | + public function generateKey(array $options = array()) | |
| 63 | + { | |
| 64 | + throw new RuntimeException(sprintf('Missing %s implementation', __METHOD__), 501); | |
| 65 | + } | |
| 66 | +} | |