* PKIStatusInfo ::= SEQUENCE { * status PKIStatus, * statusString PKIFreeText OPTIONAL, * failInfo PKIFailureInfo OPTIONAL * } * * *
* PKIStatus ::= INTEGER {
* accepted (0),
* grantedWithMods (1),
* rejection (2),
* waiting (3),
* revocationWarning (4),
* revocationNotification (5),
* keyUpdateWarning (6)
* }
*
*
*
* PKIFailureInfo ::= BIT STRING {
* badAlg (0),
* badMessageCheck (1),
* badRequest (2),
* badTime (3),
* badCertId (4),
* badDataFormat (5),
* wrongAuthority (6),
* incorrectData (7),
* missingTimeStamp (8),
* badPOP (9),
* certRevoked (10),
* certConfirmed (11),
* wrongIntegrity (12),
* badRecipientNonce (13),
* timeNotAvailable (14),
* unacceptedPolicy (15),
* unacceptedExtension (16),
* addInfoNotAvailable (17),
* badSenderNonce (18),
* badCertTemplate (19),
* signerNotTrusted (20),
* transactionIdInUse (21),
* unsupportedVersion (22),
* notAuthorized (23),
* systemUnavail (24),
* systemFailure (25),
* duplicateCertReq (26),
* extendLater (100), -- GuardTime specific extension
* extensionOverdue (101) -- GuardTime specific extension
* }
*
*
* * PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String ** * @package asn1 * @subpackage cmp * * @link http://tools.ietf.org/html/rfc4210#section-5.2.3 RFC 4210: Certificate Management Protocol */ class PKIStatusInfo { private $status; private $statusString; private $failInfo; /** * Constructs a new instance of PKIStatusInfo. */ public function __construct() { } /** * Decodes an ASN1Sequence as PKIStatusInfo. * * @throws GTException * @param ASN1Sequence $object PKIStatusInfo encoded as an ASN1Sequence * @return void */ public function decode($object) { if (!$object instanceof ASN1Sequence) { throw new GTException("Expecting an ASN1Sequence"); } $this->status = (int) $object->getObjectAt(0)->getValue(); for ($i = 1; $i < $object->getObjectCount(); $i++) { $item = $object->getObjectAt($i); if ($item instanceof ASN1BitString) { $this->failInfo = $item->getValue(); } else if ($item instanceof ASN1Sequence) { $statusString = array(); foreach ($item->getObjects() as $line) { array_push($statusString, $line->getValue()); } $this->statusString = $statusString; } else { throw new GTException("Unexpected item: " . get_class($item)); } } } /** * Gets the status code. * * @return int status code */ public function getStatus() { return $this->status; } /** * Sets the status code. * * @param int $status * @return void */ public function setStatus($status) { $this->status = $status; } /** * Gets the status message. * * @return string status message */ public function getStatusMessage() { if (!empty($this->statusString)) { return implode("\n", $this->statusString); } return ""; } /** * Gets the failure info bit string. * * @return string failure info bit string */ public function getFailInfo() { return $this->failInfo; } } ?>