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

    Represents an RSA private key as defined in RFC 8017 (PKCS #1 v2.2).

    This class specifically implements the RSAPrivateKey ASN.1 structure from PKCS #1, which differs from the generic PrivateKeyInfo structure defined in PKCS #8.

    Use this class when:

    • Working directly with RSA-specific parameters (modulus, exponents, etc.)
    • Parsing or creating traditional RSA private key formats
    • Need access to the Chinese Remainder Theorem (CRT) parameters

    For general private key handling (including non-RSA keys), use PrivateKeyInfo instead.

    RSAPrivateKey ::= SEQUENCE {
        version           Version,  -- Integer, always 0 for two-prime, 1 for multi-prime
        modulus           INTEGER,  -- n
        publicExponent    INTEGER,  -- e
        privateExponent   INTEGER,  -- d
        prime1            INTEGER,  -- p
        prime2            INTEGER,  -- q
        exponent1         INTEGER,  -- d mod (p-1)
        exponent2         INTEGER,  -- d mod (q-1)
        coefficient       INTEGER,  -- (inverse of q) mod p
        otherPrimeInfos   OtherPrimeInfos OPTIONAL
    }
    

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new RSAPrivateKey instance.

      Parameters

      • options: {
            coefficient: Uint8Array;
            exponent1: Uint8Array;
            exponent2: Uint8Array;
            modulus: Uint8Array;
            prime1: Uint8Array;
            prime2: Uint8Array;
            privateExponent: Uint8Array;
            publicExponent: Uint8Array;
            version?: number;
        }

      Returns RSAPrivateKey

    Properties

    coefficient: Uint8Array

    The CRT coefficient ((inverse of q) mod p)

    exponent1: Uint8Array

    The first exponent (d mod (p-1))

    exponent2: Uint8Array

    The second exponent (d mod (q-1))

    modulus: Uint8Array

    The modulus (n)

    prime1: Uint8Array

    The first prime factor (p)

    prime2: Uint8Array

    The second prime factor (q)

    privateExponent: Uint8Array

    The private exponent (d)

    publicExponent: Uint8Array

    The exponent (e)

    version: number

    The version (always 0 for two-prime RSA)

    Accessors

    • 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