You are here

public function OpenSSLEncryption::setCypher in Ubercart 8.4

Sets the cypher used.

Available cyphers can be seen by using the command-line command 'openssl list-cipher-algorithms'.

Parameters

string $cypher: The cypher to use.

Return value

$this

Overrides EncryptionInterface::setCypher

File

uc_store/src/OpenSSLEncryption.php, line 58

Class

OpenSSLEncryption
Provides encryption and decryption using OpenSSL.

Namespace

Drupal\uc_store

Code

public function setCypher($cypher) {
  $methods = openssl_get_cipher_methods();
  if (in_array($cypher, $methods)) {
    $this->cypher = $cypher;
  }
  else {

    // Set an error, don't change cypher.
    $this->errors[] = t('@cypher is not a valid cypher', [
      '@cypher' => $cypher,
    ]);
  }
  return $this;
}