Skip to content

Commit 5d68eb4

Browse files
authored
doc: clarify PEM format for signing keys
Signed-off-by: harjoth <harjoth.khara@gmail.com> PR-URL: #64404 Fixes: #35331 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 7a11a9b commit 5d68eb4

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

doc/api/crypto.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,8 +2665,10 @@ Calculates the signature on all the data passed through using either
26652665
[`sign.update()`][] or [`sign.write()`][stream-writable-write].
26662666

26672667
If `privateKey` is not a [`KeyObject`][], this function behaves as if
2668-
`privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an
2669-
object, the following additional properties can be passed:
2668+
`privateKey` had been passed to [`crypto.createPrivateKey()`][]. When
2669+
`privateKey` is a string, `ArrayBuffer`, [`Buffer`][], `TypedArray`, or
2670+
`DataView`, it must contain PEM-encoded key material. If it is an object, the
2671+
following additional properties can be passed:
26702672

26712673
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
26722674
format of the generated signature. It can be one of the following:
@@ -2799,8 +2801,10 @@ changes:
27992801
Verifies the provided data using the given `key` and `signature`.
28002802

28012803
If `key` is not a [`KeyObject`][], this function behaves as if
2802-
`key` had been passed to [`crypto.createPublicKey()`][]. If it is an
2803-
object, the following additional properties can be passed:
2804+
`key` had been passed to [`crypto.createPublicKey()`][]. When `key` is a string,
2805+
`ArrayBuffer`, [`Buffer`][], `TypedArray`, or `DataView`, it must contain
2806+
PEM-encoded key material. If it is an object, the following additional
2807+
properties can be passed:
28042808

28052809
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
28062810
format of the signature. It can be one of the following:
@@ -6209,8 +6213,10 @@ dependent upon the key type.
62096213
ML-DSA.
62106214

62116215
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6212-
passed to [`crypto.createPrivateKey()`][]. If it is an object, the following
6213-
additional properties can be passed:
6216+
passed to [`crypto.createPrivateKey()`][]. When `key` is a string, `ArrayBuffer`,
6217+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6218+
material. If it is an object, the following additional properties can be
6219+
passed:
62146220

62156221
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
62166222
format of the generated signature. It can be one of the following:
@@ -6349,8 +6355,10 @@ key type.
63496355
ML-DSA.
63506356

63516357
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6352-
passed to [`crypto.createPublicKey()`][]. If it is an object, the following
6353-
additional properties can be passed:
6358+
passed to [`crypto.createPublicKey()`][]. When `key` is a string, `ArrayBuffer`,
6359+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6360+
material. If it is an object, the following additional properties can be
6361+
passed:
63546362

63556363
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
63566364
format of the signature. It can be one of the following:

0 commit comments

Comments
 (0)