* TimeStampReq ::= SEQUENCE { * version INTEGER { v1(1) }, * messageImprint MessageImprint, * reqPolicy TSAPolicyId OPTIONAL, * nonce INTEGER OPTIONAL, * certReq BOOLEAN DEFAULT FALSE, * extensions [0] IMPLICIT Extensions OPTIONAL * } * * * @see TSPMessageImprint * * @package asn1 * @subpackage tsp * * @link http://tools.ietf.org/html/rfc3161#section-2.4.1 RFC 3161: Time-Stamp Protocol */ class TSPTimeStampReq implements ASN1DEREncodable { const VERSION = 1; private $version; private $messageImprint; /** * Constructs a new instance of TSPTimeStampReq. */ public function __construct() { $this->version = self::VERSION; } /** * Encodes this TSPTimestampReq using DER. * * @return array byte array that contains the DER encoding of this TSPTimestampReq */ public function encodeDER() { $sequence = new ASN1Sequence(); $sequence->add(new ASN1Integer($this->version)); $sequence->add($this->messageImprint); return $sequence->encodeDER(); } /** * Gets the version. * * @return int version */ public function getVersion() { return $this->version; } /** * Sets the message imprint. * * @throws GTException * @param TSPMessageImprint $messageImprint the message imprint * @return void */ public function setMessageImprint($messageImprint) { if (!$messageImprint instanceof TSPMessageImprint) { throw new GTException("messageImprint must be an instance of TSPMessageImprint"); } $this->messageImprint = $messageImprint; } /** * Gets the message imprint. * * @return TSPMessageImprint the message imprint */ public function getMessageImprint() { return $this->messageImprint; } } ?>