Creates a new PrivateKeyInfo instance.
Configuration object
The private key algorithm identifier
Optional
attributes?: Attribute[]Optional key attributes
The private key bytes or OctetString
Optional
version?: numberVersion number (defaults to 0)
Algorithm identifier specifying the private key algorithm and parameters.
Optional
attributesOptional attributes providing additional key metadata.
The private key material as an OCTET STRING. The format of this data depends on the algorithm.
Version number (usually 0 for PKCS#8 v1).
Gets the PEM header name for this object type. Converts the class name to uppercase for use in PEM encoding.
Gets the PKI type name for this object (typically the class name). Used for PEM headers and debugging output.
Compares this PKI object with another for equality. Two objects are considered equal if their DER encodings are identical.
The other PKI object to compare with
true if the objects are equal, false otherwise
Parses this object as a different PKI type. Useful for converting between related PKI structures.
The target type to parse as
The target type constructor with parsing capabilities
A new instance of the target type
Converts this PrivateKeyInfo to its ASN.1 representation.
The ASN.1 SEQUENCE structure
Converts this PKI object to DER (Distinguished Encoding Rules) format.
The DER-encoded bytes of this object
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.
A human-readable string representation
Converts this PKI object to PEM (Privacy-Enhanced Mail) format.
A PEM-encoded string with appropriate headers
Returns a string representation of this PKI object. Includes the type name and ASN.1 structure.
A string representation for debugging
Static
fromCreates a PrivateKeyInfo from an ASN.1 structure.
The ASN.1 structure
A PrivateKeyInfo
Static
fromStatic
from
Represents a private key in PKCS#8 format.
PrivateKeyInfo is the standard format for encoding private keys as defined in PKCS#8. It includes the algorithm identifier, the private key material, and optional attributes. This format is algorithm-agnostic and can represent RSA, ECDSA, EdDSA, and other types of private keys.
Asn
Example