Skip to content

Commit d6a43df

Browse files
committed
fixup! crypto: add signDigest/verifyDigest and Ed25519ctx support
1 parent cb2149d commit d6a43df

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

doc/api/crypto.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,7 +5789,11 @@ algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
57895789
dependent upon the key type.
57905790

57915791
`algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
5792-
ML-DSA.
5792+
ML-DSA. For Ed25519 and Ed448, this function uses the pure signature schemes
5793+
from [RFC 8032][] (or Ed25519ctx when a `context` is provided). Ed25519 and
5794+
Ed448 signatures produced by this function cannot be verified with
5795+
[`crypto.verifyDigest()`][] because it uses the Ed25519ph and Ed448ph prehash
5796+
variants which have different domain separation.
57935797

57945798
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
57955799
passed to [`crypto.createPrivateKey()`][]. If it is an object, the following
@@ -5850,10 +5854,11 @@ The interpretation of `algorithm` and `digest` depends on the key type:
58505854
use the Ed25519ph and Ed448ph prehash variants from [RFC 8032][]
58515855
respectively. `digest` must be the output of the appropriate prehash
58525856
function (SHA-512 for Ed25519ph, SHAKE256 with 64-byte output for
5853-
Ed448ph). The resulting signatures are not compatible with
5854-
[`crypto.sign()`][] or [`crypto.verify()`][] because those use the
5855-
pure Ed25519/Ed448 (or Ed25519ctx with context) variants which have
5856-
different domain separation.
5857+
Ed448ph). The resulting signatures can only be verified with
5858+
[`crypto.verifyDigest()`][], not with [`crypto.verify()`][], because
5859+
the prehash variants have different domain separation from the pure
5860+
Ed25519/Ed448 (or Ed25519ctx with context) variants used by
5861+
[`crypto.sign()`][] and [`crypto.verify()`][].
58575862
* ML-DSA: `algorithm` must be `null` or `undefined`. `digest` must be the
58585863
64-byte external mu value per FIPS 204. The resulting signatures are
58595864
compatible with [`crypto.verify()`][] when the mu value is correctly computed
@@ -5992,7 +5997,11 @@ Verifies the given signature for `data` using the given key and algorithm. If
59925997
key type.
59935998

59945999
`algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
5995-
ML-DSA.
6000+
ML-DSA. For Ed25519 and Ed448, this function uses the pure signature schemes
6001+
from [RFC 8032][] (or Ed25519ctx when a `context` is provided). Ed25519 and
6002+
Ed448 signatures produced by [`crypto.signDigest()`][] cannot be verified with
6003+
this function because they use the Ed25519ph and Ed448ph prehash variants which
6004+
have different domain separation.
59966005

59976006
If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
59986007
passed to [`crypto.createPublicKey()`][]. If it is an object, the following
@@ -6061,10 +6070,11 @@ The interpretation of `algorithm` and `digest` depends on the key type:
60616070
use the Ed25519ph and Ed448ph prehash variants from [RFC 8032][]
60626071
respectively. `digest` must be the output of the appropriate prehash
60636072
function (SHA-512 for Ed25519ph, SHAKE256 with 64-byte output for
6064-
Ed448ph). The resulting signatures are not compatible with
6065-
[`crypto.sign()`][] or [`crypto.verify()`][] because those use the
6066-
pure Ed25519/Ed448 (or Ed25519ctx with context) variants which have
6067-
different domain separation.
6073+
Ed448ph). Only signatures produced by [`crypto.signDigest()`][] can be
6074+
verified with this function, not those from [`crypto.sign()`][], because
6075+
the prehash variants have different domain separation from the pure
6076+
Ed25519/Ed448 (or Ed25519ctx with context) variants used by
6077+
[`crypto.sign()`][] and [`crypto.verify()`][].
60686078
* ML-DSA: `algorithm` must be `null` or `undefined`. `digest` must be the
60696079
64-byte external mu value per FIPS 204. Signatures produced by
60706080
[`crypto.sign()`][] can be verified with this function when the mu value is

0 commit comments

Comments
 (0)