def max_size (self): _, alts, = self.attrs max_val = len(alts) for name, val in alts: if val is not None: max_val = max (max_val, int(val)) loi = length_of_integer (max_val) return 1 + length_of_length (loi) + loi
def max_size (self): type_name, min_size, max_size = self.attrs if type_name == 'OCTET STRING' or type_name == 'UTF8String': return 1 + length_of_length (max_size) + max_size elif type_name == 'BOOLEAN': return 1 + length_of_length (1) + 1 elif type_name == 'INTEGER': if max_size is None: # this actually depends on what integer size is in use (asn1int_t) max_size = 2**64 loi = length_of_integer (int (max_size)) return 1 + length_of_length (loi) + loi elif type_name == 'NULL': return 2 else: import pdb pdb.set_trace()