PMA\libraries\plugins\auth\AuthenticationCookie::getAESSecret PHP Method

getAESSecret() public method

Derives AES secret from encryption secret.
public getAESSecret ( string $secret ) : string
$secret string the secret
return string the AES secret
    public function getAESSecret($secret)
    {
        // Grab second part, up to 16 chars
        // The MAC and AES secrets can overlap if original secret is short
        $length = strlen($secret);
        if ($length > 16) {
            return substr($secret, -16);
        }
        return $this->enlargeSecret($length == 1 ? $secret : substr($secret, 1));
    }

Usage Example

 /**
  * Test for secret splitting using getMACSecret and getAESSecret
  *
  * @return void
  *
  * @dataProvider secretsProvider
  */
 public function testAESSecretSplit($secret, $mac, $aes)
 {
     $this->assertEquals($aes, $this->object->getAESSecret($secret));
 }