You are here

protected static function LockrAes128CtrSha256KeyWrapper::decode in Lockr 7.2

Same name and namespace in other branches
  1. 7.3 vendor/lockr/lockr/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php \Lockr\KeyWrapper\LockrAes128CtrSha256KeyWrapper::decode()
2 calls to LockrAes128CtrSha256KeyWrapper::decode()
LockrAes128CtrSha256KeyWrapper::decrypt in vendor/lockr/lockr-client/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php
Decrypt the given ciphertext using encoded.
LockrAes128CtrSha256KeyWrapper::reencrypt in vendor/lockr/lockr-client/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php
Encrypt the given plaintext using the same initial state as defined by encoded.

File

vendor/lockr/lockr-client/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php, line 151

Class

LockrAes128CtrSha256KeyWrapper

Namespace

Lockr\KeyWrapper

Code

protected static function decode($encoded) {
  $parts = explode('$', $encoded, 4);
  if (!$parts || count($parts) != 4) {
    return false;
  }
  list($prefix, $key, $iv, $hmac_key) = $parts;
  if ($prefix !== self::PREFIX) {
    return false;
  }
  return array(
    base64_decode($key),
    base64_decode($iv),
    base64_decode($hmac_key),
  );
}