You are here

public static function MultiKeyWrapper::decrypt in Lockr 7.2

Same name and namespace in other branches
  1. 7.3 vendor/lockr/lockr/src/KeyWrapper/MultiKeyWrapper.php \Lockr\KeyWrapper\MultiKeyWrapper::decrypt()

Decrypt the given ciphertext using encoded.

Parameters

string $ciphertext:

string $encoded:

Return value

string|bool

Overrides KeyWrapperInterface::decrypt

1 call to MultiKeyWrapper::decrypt()
KeyClient::get in vendor/lockr/lockr-client/src/KeyClient.php
Gets a key from Lockr.

File

vendor/lockr/lockr-client/src/KeyWrapper/MultiKeyWrapper.php, line 45

Class

MultiKeyWrapper

Namespace

Lockr\KeyWrapper

Code

public static function decrypt($ciphertext, $encoded) {
  foreach (self::$wrappers as $prefix => $wrapper) {
    if (substr($encoded, 0, strlen($prefix)) === $prefix) {
      return $wrapper::decrypt($ciphertext, $encoded);
    }
  }
  return false;
}