Skip to content

decodeDerBitStringOrThrow ​

decodeDerBitStringOrThrow ​

Decodes a BIT STRING element (tag 0x03) into a DerBitString.

Unused trailing bits are returned as encoded, with a violation of X.690 §11.2.1 reported through DerBitString.nonZeroPadding, since certificates in the wild carry them.

ts
function decodeDerBitStringOrThrow(
	element: DerElement,
): DerBitString

Parameters

Throws

  • if element is mis-tagged, or claims more than seven unused bits.

Released under the MIT License.