diff options
Diffstat (limited to 'asn1crypto')
-rw-r--r-- | asn1crypto/parser.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/asn1crypto/parser.py b/asn1crypto/parser.py index 07f53ab..0a19135 100644 --- a/asn1crypto/parser.py +++ b/asn1crypto/parser.py @@ -270,11 +270,13 @@ def _dump_header(class_, method, tag, contents): id_num |= method << 5 if tag >= 31: - header += chr_cls(id_num | 31) + cont_bit = 0 while tag > 0: - continuation_bit = 0x80 if tag > 0x7F else 0 - header += chr_cls(continuation_bit | (tag & 0x7F)) + header = chr_cls(cont_bit | (tag & 0x7f)) + header + if not cont_bit: + cont_bit = 0x80 tag = tag >> 7 + header = chr_cls(id_num | 31) + header else: header += chr_cls(id_num | tag) |