- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/liveid.php
- Класс: WindowsLiveLogin
- Вызов: WindowsLiveLogin::decodeToken
function decodeToken($token, $cryptkey=null)
{
if (!$cryptkey) {
$cryptkey = $this->_cryptkey;
}
if (!$cryptkey) {
$this->fatal("Error: decodeToken: Secret key was not set. Aborting.");
}
$ivLen = 16;
$token = $this->u64($token);
$len = strlen($token);
if (!$token || ($len <= $ivLen) || (($len % $ivLen) != 0)) {
$this->debug("Error: decodeToken: Attempted to decode invalid token.");
return;
}
$iv = substr($token, 0, 16);
$crypted = substr($token, 16);
return openssl_decrypt($crypted, "AES-128-CBC", $cryptkey, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv);
}