You are here

interface EncryptionServiceInterface in Encryption 2.x

Same name and namespace in other branches
  1. 8 src/EncryptionServiceInterface.php \Drupal\encryption\EncryptionServiceInterface

Interface EncryptionServiceInterface.

@package Drupal\encryption

Hierarchy

Expanded class hierarchy of EncryptionServiceInterface

All classes that implement EncryptionServiceInterface

1 file declares its use of EncryptionServiceInterface
EncryptionServiceTest.php in tests/src/Kernel/EncryptionServiceTest.php

File

src/EncryptionServiceInterface.php, line 10

Namespace

Drupal\encryption
View source
interface EncryptionServiceInterface {

  /**
   * Encrypt a value using the encryption key from settings.php.
   *
   * @param string $value
   *   The value tobe encrypted.
   * @param bool $raw_output
   *   Should be set to TRUE if a raw output value is required. Otherwise, a
   *   url safe base64 encoded encoded string will be returned.
   *
   * @return string|null
   *   A Base64 encoded representation of the encrypted value or null if
   *   encryption fails for some reason.
   */
  public function encrypt($value, $raw_output = FALSE);

  /**
   * Decrypt a value using the encryption key from settings.php.
   *
   * @param string $value
   *   An encrypted string.
   * @param bool $raw_input
   *   Should be set to TRUE if the input value is not a base64 encoded/url safe
   *   string (Defaults to FALSE).
   *
   * @return string|null
   *   The decrypted value or null if decryption fails.
   */
  public function decrypt($value, $raw_input = FALSE);

  /**
   * Gets the `$settings['encryption_key']` value from settings.php.
   *
   * @return string|null
   *   The encryption key or null if validation fails.
   */
  public function getEncryptionKey();

}

Members

Namesort descending Modifiers Type Description Overrides
EncryptionServiceInterface::decrypt public function Decrypt a value using the encryption key from settings.php.
EncryptionServiceInterface::encrypt public function Encrypt a value using the encryption key from settings.php.
EncryptionServiceInterface::getEncryptionKey public function Gets the `$settings['encryption_key']` value from settings.php.