Ejemplo n.º 1
0
 function parse($data, $location)
 {
     list($location, $length) = $this->decodeLength($data, $location);
     $data = substr($data, $location, $length);
     $location += $length;
     parent::parseFromString($data, $this);
     return $location;
 }
Ejemplo n.º 2
0
 function parse($data, $location)
 {
     $ret = parent::parse($data, $location);
     // Y2K issues
     if ($this->value[0] < 5) {
         $this->value = '20' . $this->value;
     } else {
         $this->value = '19' . $this->value;
     }
     $this->value = new \DateTime($this->value);
     return $ret;
 }
Ejemplo n.º 3
0
 function parse($data, $location) {
     $ret = parent::parse($data, $location);
     $value = $this->value;
     $int = 0;
     $negative = ($value[0] & 0x80) === 0x80;
     if ($negative) {
         $value[strlen($value) - 1] = ord($value[strlen($value) - 1]) - 1;
         for ($i = 0; $i < strlen($value); $i++) {
             $value[$i] = ord($value[$i]) ^ 0xFF;
         }
     }
     for ($i = 0; $i < strlen($value); $i++) {
         $int <<= 8;
         $int += ord($value[$i]);
     }
     $this->value = $negative ? -$int : $int;
     return $ret;
 }
Ejemplo n.º 4
0
 function parse($data, $location)
 {
     $ret = \PEAR2\Pyrus\DER::parse($data, $location);
     $this->value = new \DateTime($this->value);
     return $ret;
 }
Ejemplo n.º 5
0
 function parse($data, $location)
 {
     $ret = parent::parse($data, $location);
     $this->value = (bool) ord($this->value);
     return $ret;
 }
Ejemplo n.º 6
0
 function parse($data, $location)
 {
     $ret = parent::parse($data, $location);
     $value = $this->value;
     $start = ord($value[0]);
     $first = floor($start / 40);
     $second = $start - $first * 40;
     $this->value = array($first, $second);
     $strlen = strlen($value);
     $long = false;
     $val = 0;
     for ($i = 1; $i < $strlen; $i++) {
         $current = ord($value[$i]);
         if (($current & 0x80) == 0x80) {
             if (!$long) {
                 $long = true;
                 $val = $current & 0x7F;
                 continue;
             }
         } elseif ($long) {
             $long = false;
             $val <<= 7;
             $val |= $current;
             $this->value[] = $val;
             $val = 0;
             continue;
         }
         if ($long) {
             $val <<= 7;
             $val |= $current & 0x7F;
         } else {
             $this->value[] = $current;
         }
     }
     return $ret;
 }
Ejemplo n.º 7
0
 function parse($data, $location)
 {
     $ret = parent::parse($data, $location);
     $unusedbits = ord($this->value[0]);
     $value = substr($this->value, 1);
     $str = '';
     $strlen = strlen($value);
     for ($i = 0; $i < $strlen; $i++) {
         if ($i == $strlen - 1) {
             $binary = substr(decbin(ord($value[$i])), 0, 8 - $unusedbits);
         } else {
             $binary = decbin(ord($value[$i]));
         }
         $str .= $binary;
     }
     $this->value = $str;
     return $ret;
 }