Skip to content

Commit 71343b2

Browse files
harjothkharaaduh95
authored andcommitted
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 0544ec1 commit 71343b2

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
@@ -2647,8 +2647,10 @@ Calculates the signature on all the data passed through using either
26472647
[`sign.update()`][] or [`sign.write()`][stream-writable-write].
26482648

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

26532655
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
26542656
format of the generated signature. It can be one of the following:
@@ -2778,8 +2780,10 @@ changes:
27782780
Verifies the provided data using the given `key` and `signature`.
27792781

27802782
If `key` is not a [`KeyObject`][], this function behaves as if
2781-
`key` had been passed to [`crypto.createPublicKey()`][]. If it is an
2782-
object, the following additional properties can be passed:
2783+
`key` had been passed to [`crypto.createPublicKey()`][]. When `key` is a string,
2784+
`ArrayBuffer`, [`Buffer`][], `TypedArray`, or `DataView`, it must contain
2785+
PEM-encoded key material. If it is an object, the following additional
2786+
properties can be passed:
27832787

27842788
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
27852789
format of the signature. It can be one of the following:
@@ -6120,8 +6124,10 @@ dependent upon the key type.
61206124
ML-DSA.
61216125

61226126
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6123-
passed to [`crypto.createPrivateKey()`][]. If it is an object, the following
6124-
additional properties can be passed:
6127+
passed to [`crypto.createPrivateKey()`][]. When `key` is a string, `ArrayBuffer`,
6128+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6129+
material. If it is an object, the following additional properties can be
6130+
passed:
61256131

61266132
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
61276133
format of the generated signature. It can be one of the following:
@@ -6255,8 +6261,10 @@ key type.
62556261
ML-DSA.
62566262

62576263
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6258-
passed to [`crypto.createPublicKey()`][]. If it is an object, the following
6259-
additional properties can be passed:
6264+
passed to [`crypto.createPublicKey()`][]. When `key` is a string, `ArrayBuffer`,
6265+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6266+
material. If it is an object, the following additional properties can be
6267+
passed:
62606268

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

0 commit comments

Comments
 (0)