[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/crypt/src/ -> CipherInterface.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Crypt Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Crypt;
  10  
  11  use Joomla\Crypt\Exception\DecryptionException;
  12  use Joomla\Crypt\Exception\EncryptionException;
  13  use Joomla\Crypt\Exception\InvalidKeyException;
  14  use Joomla\Crypt\Exception\InvalidKeyTypeException;
  15  use Joomla\Crypt\Exception\UnsupportedCipherException;
  16  
  17  /**
  18   * Joomla Framework Cipher interface.
  19   *
  20   * @since  1.0
  21   */
  22  interface CipherInterface
  23  {
  24      /**
  25       * Method to decrypt a data string.
  26       *
  27       * @param   string  $data  The encrypted string to decrypt.
  28       * @param   Key     $key   The key[/pair] object to use for decryption.
  29       *
  30       * @return  string  The decrypted data string.
  31       *
  32       * @since   1.0
  33       * @throws  DecryptionException if the data cannot be decrypted
  34       * @throws  InvalidKeyTypeException if the key is not valid for the cipher
  35       * @throws  UnsupportedCipherException if the cipher is not supported on the current environment
  36       */
  37  	public function decrypt($data, Key $key);
  38  
  39      /**
  40       * Method to encrypt a data string.
  41       *
  42       * @param   string  $data  The data string to encrypt.
  43       * @param   Key     $key   The key[/pair] object to use for encryption.
  44       *
  45       * @return  string  The encrypted data string.
  46       *
  47       * @since   1.0
  48       * @throws  EncryptionException if the data cannot be encrypted
  49       * @throws  InvalidKeyTypeException if the key is not valid for the cipher
  50       * @throws  UnsupportedCipherException if the cipher is not supported on the current environment
  51       */
  52  	public function encrypt($data, Key $key);
  53  
  54      /**
  55       * Method to generate a new encryption key[/pair] object.
  56       *
  57       * @param   array  $options  Key generation options.
  58       *
  59       * @return  Key
  60       *
  61       * @since   1.0
  62       * @throws  InvalidKeyException if the key cannot be generated
  63       * @throws  UnsupportedCipherException if the cipher is not supported on the current environment
  64       */
  65  	public function generateKey(array $options = []);
  66  
  67      /**
  68       * Check if the cipher is supported in this environment.
  69       *
  70       * @return  boolean
  71       *
  72       * @since   2.0.0
  73       */
  74  	public static function isSupported(): bool;
  75  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer