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

    Represents a CertBag structure in a PKCS#12 file.

    A CertBag is used to store certificates within PKCS#12 files. It specifies the certificate type (certId) and contains the certificate data (certValue). The most common certificate type is X.509 certificates, but other formats can also be stored.

    CertBag ::= SEQUENCE {
      certId    BAG-TYPE,
      certValue [0] EXPLICIT ANY DEFINED BY certId
    }
    
    // Create a certificate bag for an X.509 certificate
    const certBag = new CertBag({
    certId: OIDs.x509Certificate,
    certValue: certificate.toDer()
    })

    // Extract certificate from bag
    if (certBag.certId.is(OIDs.x509Certificate)) {
    const certBytes = certBag.certValue.toAsn1().valueBlock.valueHex
    const certificate = Certificate.fromDer(new Uint8Array(certBytes))
    }

    // Create from existing certificate
    const bagFromCert = CertBag.fromCertificate(certificate)

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Object identifier specifying the certificate type. Common value is OIDs.x509Certificate for X.509 certificates.

    certValue: Any

    The certificate data, format determined by certId.

    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

    • 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