function setBlockLength($length) { throw new \BadMethodCallException('The block length cannot be set for AES.'); }
private function cipher() { switch ($this->header['enc']) { case 'A128GCM': case 'A256GCM': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); case 'A128CBC-HS256': case 'A256CBC-HS512': $cipher = new AES(AES::MODE_CBC); break; default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } switch ($this->header['enc']) { case 'A128GCM': case 'A128CBC-HS256': $cipher->setBlockLength(128); break; case 'A256GCM': case 'A256CBC-HS512': $cipher->setBlockLength(256); break; default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } return $cipher; }