private static function _decodeDefiniteLength(string $data, int &$offset,
        int $length): ElementBase
    {
        $idx = $offset;
        $end = $idx + $length;
        $elements = [];
        while ($idx < $end) {
            $elements[] = Element::fromDER($data, $idx);
            // check that element didn't overflow length
            if ($idx > $end) {
                throw new DecodeException(
                    "Structure's content overflows length.");
            }
        }
        $offset = $idx;
        // return instance by static late binding
        return new static(...$elements);
    }