You are here

private static function LockrAes128CtrSha256KeyWrapper::decode in Lockr 7.3

Same name and namespace in other branches
  1. 7.2 vendor/lockr/lockr-client/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php \Lockr\KeyWrapper\LockrAes128CtrSha256KeyWrapper::decode()
2 calls to LockrAes128CtrSha256KeyWrapper::decode()
LockrAes128CtrSha256KeyWrapper::decrypt in vendor/lockr/lockr/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php
Decrypt the given ciphertext.
LockrAes128CtrSha256KeyWrapper::reencrypt in vendor/lockr/lockr/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php
Encrypt the given plaintext reusing state.

File

vendor/lockr/lockr/src/KeyWrapper/LockrAes128CtrSha256KeyWrapper.php, line 112

Class

LockrAes128CtrSha256KeyWrapper

Namespace

Lockr\KeyWrapper

Code

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