private static function _decodeIndefiniteLength(string $data, int &$offset): ElementBase
    {
        $idx = $offset;
        $elements = [];
        $end = strlen($data);
        while (true) {
            if ($idx >= $end) {
                throw new DecodeException(
                    'Unexpected end of data while decoding indefinite length structure.');
            }
            $el = Element::fromDER($data, $idx);
            if ($el->isType(self::TYPE_EOC)) {
                break;
            }
            $elements[] = $el;
        }
        $offset = $idx;
        $type = new static(...$elements);
        $type->_indefiniteLength = true;
        return $type;
    }