= 0; $i--) { array_unshift($stream, $bytes[$i]); } } /** * Reads a single byte from the given stream. * * @param arrayref &$stream the stream to read from * @return int single byte */ protected function readByte(&$stream) { $bytes = $this->readBytes($stream, 1); return array_shift($bytes); } /** * Reads multiple bytes from the given stream. * * @throws GTException * @param arrayref &$stream the stream to read from * @param int $limit number of bytes to read * @return array byte array containing the bytes read from stream */ protected function readBytes(&$stream, $limit) { if (!is_array($stream)) { throw new GTException("parameter stream must be an array of bytes"); } if (count($stream) < $limit) { throw new GTException("not enough bytes, tried to read {$limit}, but only " . count($stream) . " remaining"); } $bytes = array(); for ($i = 0; $i < $limit; $i++) { array_push($bytes, array_shift($stream)); } return $bytes; } /** * Sets the tag class for this ASN1 Object. * * Valid values are: *
     * ASN1_TAG_CONEXT
     * ASN1_TAG_PRIVATE
     * ASN1_TAG_UNIVERSAL
     * ASN1_TAG_APPLICATION
     * 
* * @param $tagClass the tag class to set * @return void */ public function setTagClass($tagClass) { $this->tagClass = $tagClass; } /** * Gets the tag class for this ASN1 Object. * * @return string the tag class */ public function getTagClass() { return $this->tagClass; } /** * Sets the tag type for this ASN1 Object. * * Valid values are: *
     * ASN1_TAG_PRIMITIVE
     * ASN1_TAG_CONSTRUCTED
     * 
* * @param $tagType the tag type to set * @return void */ public function setTagType($tagType) { $this->tagType = $tagType; } /** * Gets the tag value for this ASN1 Object. * * @return string the tag type */ public function getTagType() { return $this->tagType; } /** * Sets the tag value for this ASN1 Object. * * @param int $tagValue the tag value * @return void */ public function setTagValue($tagValue) { $this->tagValue = $tagValue; } /** * Gets the tag value for this ASN1 Object. * * @return int the tag value */ public function getTagValue() { return $this->tagValue; } } ?>