You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds support for the PSS padding scheme. Until now, the sign/verify
functions used the old EVP_Sign*/EVP_Verify* OpenSSL API, making it
impossible to change the padding scheme. Fixed by first computing the
message digest and then signing/verifying with a custom EVP_PKEY_CTX,
allowing us to specify options such as the padding scheme and the PSS
salt length.
Fixes: #1127
PR-URL: #11705
Reviewed-By: Shigeki Ohtsu <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
description: Support for RSASSA-PSS and additional options was added.
994
1013
-->
1014
+
-`object` {string | Object}
1015
+
-`signature` {string | Buffer | Uint8Array}
1016
+
-`signature_format` {string}
995
1017
996
1018
Verifies the provided data using the given `object` and `signature`.
997
-
The `object` argument is a string containing a PEM encoded object, which can be
998
-
one an RSA public key, a DSA public key, or an X.509 certificate.
1019
+
The `object` argument can be either a string containing a PEM encoded object,
1020
+
which can be an RSA public key, a DSA public key, or an X.509 certificate,
1021
+
or an object with one or more of the following properties:
1022
+
1023
+
*`key`: {string} - PEM encoded public key (required)
1024
+
*`padding`: {integer} - Optional padding value for RSA, one of the following:
1025
+
*`crypto.constants.RSA_PKCS1_PADDING` (default)
1026
+
*`crypto.constants.RSA_PKCS1_PSS_PADDING`
1027
+
1028
+
Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function
1029
+
used to verify the message as specified in section 3.1 of [RFC 4055][].
1030
+
*`saltLength`: {integer} - salt length for when padding is
1031
+
`RSA_PKCS1_PSS_PADDING`. The special value
1032
+
`crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest
1033
+
size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be
1034
+
determined automatically.
1035
+
999
1036
The `signature` argument is the previously calculated signature for the data, in
1000
1037
the `signature_format` which can be `'latin1'`, `'hex'` or `'base64'`.
1001
1038
If a `signature_format` is specified, the `signature` is expected to be a
@@ -1902,6 +1939,21 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
1902
1939
<td><code>RSA_PKCS1_PSS_PADDING</code></td>
1903
1940
<td></td>
1904
1941
</tr>
1942
+
<tr>
1943
+
<td><code>RSA_PSS_SALTLEN_DIGEST</code></td>
1944
+
<td>Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size
1945
+
when signing or verifying.</td>
1946
+
</tr>
1947
+
<tr>
1948
+
<td><code>RSA_PSS_SALTLEN_MAX_SIGN</code></td>
1949
+
<td>Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum
1950
+
permissible value when signing data.</td>
1951
+
</tr>
1952
+
<tr>
1953
+
<td><code>RSA_PSS_SALTLEN_AUTO</code></td>
1954
+
<td>Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined
1955
+
automatically when verifying a signature.</td>
1956
+
</tr>
1905
1957
<tr>
1906
1958
<td><code>POINT_CONVERSION_COMPRESSED</code></td>
1907
1959
<td></td>
@@ -1977,6 +2029,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
1977
2029
[publicly trusted list of CAs]: https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt
0 commit comments