This PR fixes a couple of issues with PER-encoding extensible string types, such as BIT STRING, OCTET STRING or VisibleString. Before, extensible string types were in some cases encoded with a duplicate extension marker, in some cases with a wrong length determinant.
I also refactored the string encoders so that extension bits are always written using the encode_extensible_bit function, and removed some code duplication by having encode_length call the encode_string_length function, which is largely identical.
This PR fixes a couple of issues with PER-encoding extensible string types, such as
BIT STRING
,OCTET STRING
orVisibleString
. Before, extensible string types were in some cases encoded with a duplicate extension marker, in some cases with a wrong length determinant. I also refactored the string encoders so that extension bits are always written using theencode_extensible_bit
function, and removed some code duplication by havingencode_length
call theencode_string_length
function, which is largely identical.