Skip to content

Commit 630aa4b

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 e65b2ca commit 630aa4b

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

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

26622664
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
26632665
format of the generated signature. It can be one of the following:
@@ -2787,8 +2789,10 @@ changes:
27872789
Verifies the provided data using the given `key` and `signature`.
27882790

27892791
If `key` is not a [`KeyObject`][], this function behaves as if
2790-
`key` had been passed to [`crypto.createPublicKey()`][]. If it is an
2791-
object, the following additional properties can be passed:
2792+
`key` had been passed to [`crypto.createPublicKey()`][]. When `key` is a string,
2793+
`ArrayBuffer`, [`Buffer`][], `TypedArray`, or `DataView`, it must contain
2794+
PEM-encoded key material. If it is an object, the following additional
2795+
properties can be passed:
27922796

27932797
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
27942798
format of the signature. It can be one of the following:
@@ -6141,8 +6145,10 @@ dependent upon the key type.
61416145
ML-DSA.
61426146

61436147
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6144-
passed to [`crypto.createPrivateKey()`][]. If it is an object, the following
6145-
additional properties can be passed:
6148+
passed to [`crypto.createPrivateKey()`][]. When `key` is a string, `ArrayBuffer`,
6149+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6150+
material. If it is an object, the following additional properties can be
6151+
passed:
61466152

61476153
* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the
61486154
format of the generated signature. It can be one of the following:
@@ -6276,8 +6282,10 @@ key type.
62766282
ML-DSA.
62776283

62786284
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
6279-
passed to [`crypto.createPublicKey()`][]. If it is an object, the following
6280-
additional properties can be passed:
6285+
passed to [`crypto.createPublicKey()`][]. When `key` is a string, `ArrayBuffer`,
6286+
[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key
6287+
material. If it is an object, the following additional properties can be
6288+
passed:
62816289

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

0 commit comments

Comments
 (0)