You are here

interface EncryptionMethodInterface in Encrypt 8.3

Provides an interface for EncryptionMethod plugins.

@package Drupal\encrypt

Hierarchy

Expanded class hierarchy of EncryptionMethodInterface

All classes that implement EncryptionMethodInterface

7 files declare their use of EncryptionMethodInterface
AsymmetricalEncryptionMethod.php in tests/modules/encrypt_test/src/Plugin/EncryptionMethod/AsymmetricalEncryptionMethod.php
ConfigTestEncryptionMethod.php in tests/modules/encrypt_test/src/Plugin/EncryptionMethod/ConfigTestEncryptionMethod.php
EncryptionMethodBase.php in src/Plugin/EncryptionMethod/EncryptionMethodBase.php
EncryptionProfile.php in src/Entity/EncryptionProfile.php
EncryptionProfileTest.php in tests/src/Unit/Entity/EncryptionProfileTest.php

... See full list

File

src/EncryptionMethodInterface.php, line 12

Namespace

Drupal\encrypt
View source
interface EncryptionMethodInterface extends PluginInspectionInterface {

  /**
   * Encrypt text.
   *
   * @param string $text
   *   The text to be encrypted.
   * @param string $key
   *   The key to encrypt the text with.
   *
   * @return string
   *   The encrypted text
   *
   * @throws \Drupal\encrypt\Exception\EncryptException
   *   Thrown when encryption fails.
   */
  public function encrypt($text, $key);

  /**
   * Decrypt text.
   *
   * @param string $text
   *   The text to be decrypted.
   * @param string $key
   *   The key to decrypt the text with.
   *
   * @return string
   *   The decrypted text
   *
   * @throws \Drupal\encrypt\Exception\EncryptException
   *   Thrown when decryption fails.
   * @throws \Drupal\encrypt\Exception\EncryptionMethodCanNotDecryptException
   *   The method should throw this exception when the plugin can not decrypt
   *   (i.e. use a public key).
   */
  public function decrypt($text, $key);

  /**
   * Check dependencies for the encryption method.
   *
   * @param string $text
   *   The text to be checked.
   * @param string $key
   *   The key to be checked.
   *
   * @return array
   *   An array of error messages, providing info on missing dependencies.
   */
  public function checkDependencies($text = NULL, $key = NULL);

  /**
   * Get the label.
   *
   * @return string
   *   The label for this EncryptionMethod plugin.
   */
  public function getLabel();

  /**
   * Define if encryption method can also decrypt.
   *
   * @return bool
   *   TRUE if encryption method decrypt, FALSE otherwise.
   */
  public function canDecrypt();

  /**
   * Define if encryption method is deprecated.
   *
   * @return bool
   *   TRUE if encryption method is deprecated, FALSE otherwise.
   */
  public function isDeprecated();

}

Members

Namesort descending Modifiers Type Description Overrides
EncryptionMethodInterface::canDecrypt public function Define if encryption method can also decrypt. 1
EncryptionMethodInterface::checkDependencies public function Check dependencies for the encryption method. 3
EncryptionMethodInterface::decrypt public function Decrypt text. 3
EncryptionMethodInterface::encrypt public function Encrypt text. 3
EncryptionMethodInterface::getLabel public function Get the label. 1
EncryptionMethodInterface::isDeprecated public function Define if encryption method is deprecated. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2