From 058781ddf4dcdb3eb7a9a698436eebd406827036 Mon Sep 17 00:00:00 2001 From: harjoth Date: Thu, 9 Jul 2026 23:41:35 -0700 Subject: [PATCH] doc: clarify PEM format for signing keys Signed-off-by: harjoth --- doc/api/crypto.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index b73093c648a90d..3bb09483573279 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2665,8 +2665,10 @@ Calculates the signature on all the data passed through using either [`sign.update()`][] or [`sign.write()`][stream-writable-write]. If `privateKey` is not a [`KeyObject`][], this function behaves as if -`privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an -object, the following additional properties can be passed: +`privateKey` had been passed to [`crypto.createPrivateKey()`][]. When +`privateKey` is a string, `ArrayBuffer`, [`Buffer`][], `TypedArray`, or +`DataView`, it must contain PEM-encoded key material. If it is an object, the +following additional properties can be passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: @@ -2799,8 +2801,10 @@ changes: Verifies the provided data using the given `key` and `signature`. If `key` is not a [`KeyObject`][], this function behaves as if -`key` had been passed to [`crypto.createPublicKey()`][]. If it is an -object, the following additional properties can be passed: +`key` had been passed to [`crypto.createPublicKey()`][]. When `key` is a string, +`ArrayBuffer`, [`Buffer`][], `TypedArray`, or `DataView`, it must contain +PEM-encoded key material. If it is an object, the following additional +properties can be passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: @@ -6209,8 +6213,10 @@ dependent upon the key type. ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been -passed to [`crypto.createPrivateKey()`][]. If it is an object, the following -additional properties can be passed: +passed to [`crypto.createPrivateKey()`][]. When `key` is a string, `ArrayBuffer`, +[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key +material. If it is an object, the following additional properties can be +passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: @@ -6349,8 +6355,10 @@ key type. ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been -passed to [`crypto.createPublicKey()`][]. If it is an object, the following -additional properties can be passed: +passed to [`crypto.createPublicKey()`][]. When `key` is a string, `ArrayBuffer`, +[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key +material. If it is an object, the following additional properties can be +passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: