PKIStatusInfo status = granted (0)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const TIMESTAMP_GRANTED = 1;
/**
* Reserved as alias for PKIStatusInfo status = grantedWithMods (1)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const TIMESTAMP_GRANTED_WITH_MODS = 2;
/**
* Reserved as alias for PKIStatusInfo status = rejection (2)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const TIMESTAMP_REJECTED = 4;
/**
* Reserved as alias for PKIStatusInfo status = waiting (3)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const TIMESTAMP_WAITING = 8;
/**
* Reserved as alias for PKIStatusInfo status = revocationWarning (4)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const REVOCATION_WARNING = 16;
/**
* Reserved as alias for PKIStatusInfo status = revocationNotification (5)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getStatusCode, hasStatus
*/
const REVOCATION_NOTIFICATION = 32;
/**
* Timestamp extension was attempted during verification.
*
* @see getStatusCode, hasStatus
*/
const EXTENSION_ATTEMPTED = 128;
/**
* Timestamp was successfully extended during verification.
*
* @see getStatusCode, hasStatus
*/
const TIMESTAMP_EXTENDED = 256;
/******************************************* ERROR CODES *******************************************/
/**
* Reserved as alias for PKIStatusInfo fail = badAlg (0)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const INVALID_ALGORITHM_FAILURE = 1;
/**
* Reserved as alias for PKIStatusInfo fail = badRequest (2)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const INVALID_REQUEST_FAILURE = 2;
/**
* Reserved as alias for PKIStatusInfo fail = badDataFormat (5)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const INVALID_DATA_FORMAT_FAILURE = 4;
/**
* Reserved as alias for PKIStatusInfo fail = timeNotAvailalble (14)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const TIME_NOT_AVAILBLE_FAILURE = 8;
/**
* Reserved as alias for PKIStatusInfo fail = unacceptedPolicy (15)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const UNACCEPTED_POLICY_FAILURE = 16;
/**
* Reserved as alias for PKIStatusInfo fail = unacceptedExtension (16)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const UNACCEPTED_EXTENSION_FAILURE = 32;
/**
* Reserved as alias for PKIStatusInfo fail = addInfoNotAvailalble (17)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const ADDITIONAL_INFO_NOT_AVAILABLE_FAILURE = 64;
/**
* Reserved as alias for PKIStatusInfo fail = systemFailure (25)
* from {@link http://tools.ietf.org/html/rfc3161#section-2.4.2 RFC 3161}.
*
* @see getErrorCode, hasError
*/
const SYSTEM_FAILURE = 128;
/**
* Timestamp is too new to be extended.
*
* @see getErrorCode, hasError
*/
const TIMESTAMP_TOO_NEW_FAILURE = 256;
/**
* Timestamp is too old to be extended.
*
* @see getErrorCode, hasError
*/
const TIMESTAMP_TOO_OLD_FAILURE = 512;
/**
* Service response has invalid format.
*
* @see getErrorCode, hasError
*/
const RESPONSE_FORMAT_FAILURE = 2048;
/**
* Service is unreachable, possibly network error or malformed URL.
*
* @see getErrorCode, hasError
*/
const SERVICE_UNREACHABLE_FAILURE = 8192;
private $gtResult = null;
/**
* Sets the timestamp verification result.
*
* @param GTVerificationResult $gtResult timestamp verification result
* @return void
*/
public function setGtResult(GTVerificationResult $gtResult) {
$this->gtResult = $gtResult;
}
/**
* Gets the timestamp verification result.
*
* @return GTVerificationResult timestamp verification result
*/
public function getGtResult() {
return $this->gtResult;
}
/**
* Checks if this verification result is valid.
*
* @return bool true if verification was successful
*/
public function isValid() {
$errorCode = $this->getErrorCode();
if ($errorCode == self::NO_FAILURES ||
$errorCode == self::TIMESTAMP_TOO_NEW_FAILURE ||
$errorCode == self::TIMESTAMP_TOO_OLD_FAILURE ||
$errorCode == self::SERVICE_UNREACHABLE_FAILURE) {
if ($this->gtResult === null) {
return false;
} else {
return $this->gtResult->isValid();
}
} else {
return false;
}
}
}
?>