* VerificationRequest :: = SEQUENCE { * version INTEGER { v1(1) }, * content ContentInfo, * data OCTET STRING * } * * * @package asn1 * @subpackage gt */ class GTVerificationRequest implements ASN1DEREncodable { private $version; private $content; private $data; /** * Constructs a new instance of GTVerificationRequest. * */ public function __construct() { } /** * Decodes the given ASN1Sequence as GTVerificationRequest. * * @throws GTException * @param ASN1Sequence $object GTVerificationRequest encoded as ASN1Sequence * @return void */ public function decode($object) { if (!$object instanceof ASN1Sequence) { throw new GTException("Expecting an ASN1Sequence"); } $size = $object->getObjectCount(); if ($size != 3) { throw new GTException("Invalid sequence size: {$size}"); } $version = $object->getObjectAt(0); if (!$version instanceof ASN1Integer) { throw new GTException("Expecting an ASN1Integer as version"); } $this->version = (int) $version->getValue(); if ($this->version != 1) { throw new GTException("Invalid value for version: {$this->version}"); } $content = new CMSContentInfo(); $content->decode($object->getObjectAt(1)); $this->content = $content; $data = $object->getObjectAt(2); if (!$data instanceof ASN1OctetString) { throw new GTException("Expecting an ASN1OctetString as data"); } $this->data = $data->getValue(); } /** * Encodes this GTVerificationRequest using DER. * * @return array byte array that contains the DER encoding of this GTVerificationRequest */ public function encodeDER() { $sequence = new ASN1Sequence(); $sequence->add(new ASN1Integer($this->version)); $sequence->add($this->content); $sequence->add(new ASN1OctetString($this->data)); return $sequence->encodeDER(); } /** * Gets the version. * * @return int version */ public function getVersion() { return $this->version; } /** * Sets the version. * * @param int $version the version * @return void */ public function setVersion($version) { $this->version = $version; } /** * Gets the content (timestamp). * * @return CMSContentInfo timestamp */ public function getContent() { return $this->content; } /** * Sets the content (timestamp). * * @param CMSContentInfo $content timestamp * @return void */ public function setContent($content) { $this->content = $content; } /** * Gets the data. * * @return array byte array containing the data bytes. */ public function getData() { return $this->data; } /** * Sets the data. * * @param array $data byte array containing the data bytes. * @return void */ public function setData($data) { $this->data = $data; } } ?>