You are here

interface BaseMethodInterface in DRD Agent 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Crypt/BaseMethodInterface.php \Drupal\drd_agent\Crypt\BaseMethodInterface

Provides an interface for encryption methods.

Hierarchy

Expanded class hierarchy of BaseMethodInterface

All classes that implement BaseMethodInterface

2 files declare their use of BaseMethodInterface
Base.php in src/Agent/Action/Base.php
BaseInterface.php in src/Agent/Action/BaseInterface.php

File

src/Crypt/BaseMethodInterface.php, line 10

Namespace

Drupal\drd_agent\Crypt
View source
interface BaseMethodInterface {

  /**
   * Get the crypt method label.
   *
   * @return string
   *   The label.
   */
  public function getLabel() : string;

  /**
   * Find out if the crypt method is available.
   *
   * @return bool
   *   TRUE if method is available.
   */
  public function isAvailable() : bool;

  /**
   * Get a list of available cipher methods.
   *
   * @return array
   *   List of methods.
   */
  public function getCipherMethods() : array;

  /**
   * Get an initialiation vector.
   *
   * @return string
   *   The IV.
   */
  public function getIv() : string;

  /**
   * Get the selected cipher.
   *
   * @return string|bool
   *   The cipher.
   */
  public function getCipher();

  /**
   * Get the password.
   *
   * @return string
   *   The password.
   */
  public function getPassword() : string;

  /**
   * Encrypt and encode any list of arguments.
   *
   * @param array $args
   *   The arguments to be encrpyted.
   *
   * @return string
   *   Encrypted and base64 encoded serialisation of the arguments.
   */
  public function encrypt(array $args) : string;

  /**
   * Decode, decrypt and unserialize arguments from the other end.
   *
   * @param string $body
   *   The encrypted, serialized and encoded string to process.
   * @param string $iv
   *   The initialiation vector.
   *
   * @return mixed
   *   The decoded, decrypted and unserialized arguments.
   */
  public function decrypt($body, $iv);

  /**
   * Encrypt a file.
   *
   * @param string $filename
   *   Filename which should be encrypted.
   *
   * @return string
   *   Filename of the encrypted version.
   */
  public function encryptFile($filename) : string;

}

Members

Namesort descending Modifiers Type Description Overrides
BaseMethodInterface::decrypt public function Decode, decrypt and unserialize arguments from the other end. 3
BaseMethodInterface::encrypt public function Encrypt and encode any list of arguments. 3
BaseMethodInterface::encryptFile public function Encrypt a file. 1
BaseMethodInterface::getCipher public function Get the selected cipher. 3
BaseMethodInterface::getCipherMethods public function Get a list of available cipher methods. 3
BaseMethodInterface::getIv public function Get an initialiation vector. 3
BaseMethodInterface::getLabel public function Get the crypt method label. 3
BaseMethodInterface::getPassword public function Get the password. 3
BaseMethodInterface::isAvailable public function Find out if the crypt method is available. 3