Creates a new ECPrivateKey
Optional
namedThe named curve OID (if parameters are present) Most commonly this is a string like '1.2.840.10045.3.1.7' for P-256
The private key value as an octet string
Optional
publicThe key component (if included)
The version of the EC private key structure (always 1)
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 the ECPrivateKey to an ASN.1 structure
Converts the ECPrivateKey to a DER-encoded byte array
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 the ECPrivateKey to a PEM-encoded string
Returns a string representation of this PKI object. Includes the type name and ASN.1 structure.
A string representation for debugging
Static
forCreates an ECPrivateKey for a specific named curve
The named curve OID (e.g., EC_CURVES.SECP256R1)
The private key value
Optional
publicKey: Uint8Array<ArrayBufferLike>Optional key value
An ECPrivateKey object
Static
fromCreates an ECPrivateKey from an ASN.1 structure
The ASN.1 structure
An ECPrivateKey object
Static
fromCreates an ECPrivateKey from a DER-encoded byte array
The DER-encoded ECPrivateKey
An ECPrivateKey object
Static
fromCreates an ECPrivateKey from a PEM-encoded string
The PEM-encoded ECPrivateKey
An ECPrivateKey object
Represents an EC private key according to RFC 5915.
ASN.1 Structure: