__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php /* * This file is part of the PHPASN1 library. * * Copyright © Friedrich Große <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace FG\ASN1\Universal; use Exception; use FG\Utility\BigInteger; use FG\ASN1\Exception\ParserException; use FG\ASN1\ASNObject; use FG\ASN1\Parsable; use FG\ASN1\Identifier; class Integer extends ASNObject implements Parsable { /** @var int */ private $value; /** * @param int $value * * @throws Exception if the value is not numeric */ public function __construct($value) { if (is_numeric($value) == false) { throw new Exception("Invalid VALUE [{$value}] for ASN1_INTEGER"); } $this->value = $value; } public function getType() { return Identifier::INTEGER; } public function getContent() { return $this->value; } protected function calculateContentLength() { return strlen($this->getEncodedValue()); } protected function getEncodedValue() { $value = BigInteger::create($this->value, 10); $negative = $value->compare(0) < 0; if ($negative) { $value = $value->absoluteValue(); $limit = 0x80; } else { $limit = 0x7f; } $mod = 0xff+1; $values = []; while($value->compare($limit) > 0) { $values[] = $value->modulus($mod)->toInteger(); $value = $value->shiftRight(8); } $values[] = $value->modulus($mod)->toInteger(); $numValues = count($values); if ($negative) { for ($i = 0; $i < $numValues; $i++) { $values[$i] = 0xff - $values[$i]; } for ($i = 0; $i < $numValues; $i++) { $values[$i] += 1; if ($values[$i] <= 0xff) { break; } assert($i != $numValues - 1); $values[$i] = 0; } if ($values[$numValues - 1] == 0x7f) { $values[] = 0xff; } } $values = array_reverse($values); $r = pack("C*", ...$values); return $r; } private static function ensureMinimalEncoding($binaryData, $offsetIndex) { // All the first nine bits cannot equal 0 or 1, which would // be non-minimal encoding for positive and negative integers respectively if ((ord($binaryData[$offsetIndex]) == 0x00 && (ord($binaryData[$offsetIndex+1]) & 0x80) == 0) || (ord($binaryData[$offsetIndex]) == 0xff && (ord($binaryData[$offsetIndex+1]) & 0x80) == 0x80)) { throw new ParserException("Integer not minimally encoded", $offsetIndex); } } public static function fromBinary(&$binaryData, &$offsetIndex = 0) { $parsedObject = new static(0); self::parseIdentifier($binaryData[$offsetIndex], $parsedObject->getType(), $offsetIndex++); $contentLength = self::parseContentLength($binaryData, $offsetIndex, 1); if ($contentLength > 1) { self::ensureMinimalEncoding($binaryData, $offsetIndex); } $isNegative = (ord($binaryData[$offsetIndex]) & 0x80) != 0x00; $number = BigInteger::create(ord($binaryData[$offsetIndex++]) & 0x7F); for ($i = 0; $i < $contentLength - 1; $i++) { $number = $number->multiply(0x100)->add(ord($binaryData[$offsetIndex++])); } if ($isNegative) { $number = $number->subtract(BigInteger::create(2)->toPower(8 * $contentLength - 1)); } $parsedObject = new static((string)$number); $parsedObject->setContentLength($contentLength); return $parsedObject; } }
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| BMPString.php | File | 1.06 KB | 0664 |
|
| BitString.php | File | 2.8 KB | 0664 |
|
| Boolean.php | File | 1.75 KB | 0664 |
|
| CharacterString.php | File | 586 B | 0664 |
|
| Enumerated.php | File | 427 B | 0664 |
|
| GeneralString.php | File | 747 B | 0664 |
|
| GeneralizedTime.php | File | 4.77 KB | 0664 |
|
| GraphicString.php | File | 748 B | 0664 |
|
| IA5String.php | File | 799 B | 0664 |
|
| Integer.php | File | 3.79 KB | 0664 |
|
| NullObject.php | File | 1.28 KB | 0664 |
|
| NumericString.php | File | 841 B | 0664 |
|
| ObjectDescriptor.php | File | 560 B | 0664 |
|
| ObjectIdentifier.php | File | 3.81 KB | 0664 |
|
| OctetString.php | File | 2.26 KB | 0664 |
|
| PrintableString.php | File | 1.37 KB | 0664 |
|
| RelativeObjectIdentifier.php | File | 1.8 KB | 0664 |
|
| Sequence.php | File | 490 B | 0664 |
|
| Set.php | File | 414 B | 0664 |
|
| T61String.php | File | 793 B | 0664 |
|
| UTCTime.php | File | 2.38 KB | 0664 |
|
| UTF8String.php | File | 744 B | 0664 |
|
| UniversalString.php | File | 826 B | 0664 |
|
| VisibleString.php | File | 748 B | 0664 |
|