Asn1BitString

constructor(source: BitSet)(source)

Creates an ASN.1 BIT STRING from the provided bitSet. The transformation to rawBytes and the calculation of numPaddingBits happens immediately in the constructor. Hence, modifications to the source BitSet have no effect on the resulting Asn1BitString.

BEWARE: a bitset (as BitSet implements it) is, by definition only as long as the highest bit set! Hence, trailing zeroes are ALWAYS stripped. If you require tailing zeroes, the easiest quick-and-dirty hack to accomplish this in general is as follows:

  • set the last bit you require as tailing zero to one

  • call this constructor

  • flip the previously set bit back (this will be the lowest bit set in last byte of rawBytes).

Parameters

source

the source BitSet, which is discarded after rawBytes and numPaddingBits have been calculated