Beispiel #1
0
function KSMdecryptOTP($urls, $logger, $curlopts)
{
    if (!is_array($urls)) {
        $urls = array($urls);
    }
    $response = retrieveURLasync('YK-KSM', $urls, $logger, $ans_req = 1, $match = '^OK', $returl = False, $timeout = 10, $curlopts);
    if ($response === FALSE) {
        return false;
    }
    $response = array_shift($response);
    $logger->log(LOG_DEBUG, log_format('YK-KSM response: ', $response));
    $ret = array();
    if (sscanf($response, 'OK counter=%04x low=%04x high=%02x use=%02x', $ret['session_counter'], $ret['low'], $ret['high'], $ret['session_use']) !== 4) {
        return false;
    }
    return $ret;
}
Beispiel #2
0
function slog($obj)
{
    if (is_string($obj)) {
        $obj = log_format($obj);
    }
    Zend_Registry::get("logger")->log($obj, Zend_Log::INFO);
}
Beispiel #3
0
function KSMdecryptOTP($urls, $logger)
{
    $ret = array();
    if (!is_array($urls)) {
        $urls = array($urls);
    }
    $response = retrieveURLasync("YK-KSM", $urls, $logger, $ans_req = 1, $match = "^OK", $returl = False, $timeout = 10);
    if (is_array($response)) {
        $response = $response[0];
    }
    if ($response) {
        $logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response));
    }
    if (sscanf($response, "OK counter=%04x low=%04x high=%02x use=%02x", $ret["session_counter"], $ret["low"], $ret["high"], $ret["session_use"]) != 4) {
        return false;
    }
    return $ret;
}