PKI-Lite - v1.0.5
    Preparing search index...

    Represents an ASN.1 BIT STRING value.

    A BIT STRING is used to represent sequences of bits. It's commonly used in PKI for public keys, signatures, and bit flags. The string can contain any number of bits, not necessarily a multiple of 8.

    BIT STRING ::= 
    
    // Create from bytes
    const bitString = new BitString({ value: new Uint8Array([0x04, 0x20, 0xAB, 0xCD]) })

    // Create from PKI object (e.g., public key)
    const publicKeyBitString = new BitString({ value: subjectPublicKeyInfo })

    // Get hex representation
    console.log(bitString.toHexString()) // "0420abcd"

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    bytes: Uint8Array

    The bytes representing this bit string.

    Accessors

    • get pemHeader(): string

      Gets the PEM header name for this object type. Converts the class name to uppercase for use in PEM encoding.

      Returns string

    • get pkiType(): string

      Gets the PKI type name for this object (typically the class name). Used for PEM headers and debugging output.

      Returns string

    Methods

    • Compares this PKI object with another for equality. Two objects are considered equal if their DER encodings are identical.

      Parameters

      • other: PkiBase<any>

        The other PKI object to compare with

      Returns boolean

      true if the objects are equal, false otherwise

    • Converts the BitString to a hexadecimal string representation. Each byte is represented as two lowercase hex digits.

      Returns string

      The hexadecimal string (e.g., "0420abcd")

    • Returns a human-readable string representation of this object. By default, returns the same as toString(), but subclasses can override for more user-friendly output.

      Returns string

      A human-readable string representation