예제 #1
0
파일: Object.php 프로젝트: afk11/phpasn1
 protected static function parseBinaryIdentifier($binaryData, &$offsetIndex)
 {
     if (strlen($binaryData) <= $offsetIndex) {
         throw new ParserException('Can not parse identifier from data: Offset index larger than input size', $offsetIndex);
     }
     $identifier = $binaryData[$offsetIndex++];
     if (Identifier::isLongForm(ord($identifier)) == false) {
         return $identifier;
     }
     while (true) {
         if (strlen($binaryData) <= $offsetIndex) {
             throw new ParserException('Can not parse identifier (long form) from data: Offset index larger than input size', $offsetIndex);
         }
         $nextOctet = $binaryData[$offsetIndex++];
         $identifier .= $nextOctet;
         if ((ord($nextOctet) & 0x80) === 0) {
             // the most significant bit is 0 to we have reached the end of the identifier
             break;
         }
     }
     return $identifier;
 }
예제 #2
0
파일: Object.php 프로젝트: Adapik/PHPASN1
 /**
  * Returns all identifier octets. If an inheriting class models a tag with
  * the long form identifier format, it MUST reimplement this method to
  * return all octets of the identifier.
  *
  * @throws LogicException If the identifier format is long form
  *
  * @return string Identifier as a set of octets
  */
 public function getIdentifier()
 {
     $firstOctet = $this->getType();
     if (Identifier::isLongForm($firstOctet)) {
         throw new LogicException(sprintf('Identifier of %s uses the long form and must therefor override "Object::getIdentifier()".', get_class($this)));
     }
     return chr($firstOctet);
 }
예제 #3
0
파일: Object.php 프로젝트: Naugrimm/PHPASN1
 protected static function parseBinaryIdentifier($binaryData, &$offsetIndex)
 {
     $identifier = $binaryData[$offsetIndex++];
     if (Identifier::isLongForm(ord($identifier)) == false) {
         return $identifier;
     }
     while (true) {
         $nextOctet = $binaryData[$offsetIndex++];
         $identifier .= $nextOctet;
         if ((ord($nextOctet) & 0x80) === 0) {
             // the most significant bit is 0 to we have reached the end of the identifier
             break;
         }
     }
     return $identifier;
 }