Skip to content

Commit 7f90586

Browse files
panvaaduh95
authored andcommitted
doc: clarify x509.checkIssued only checks metadata
PR-URL: #58457 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 1f1e194 commit 7f90586

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

doc/api/crypto.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,23 @@ added: v15.6.0
26472647
* `otherCert` {X509Certificate}
26482648
* Returns: {boolean}
26492649

2650-
Checks whether this certificate was issued by the given `otherCert`.
2650+
Checks whether this certificate was potentially issued by the given `otherCert`
2651+
by comparing the certificate metadata.
2652+
2653+
This is useful for pruning a list of possible issuer certificates which have been
2654+
selected using a more rudimentary filtering routine, i.e. just based on subject
2655+
and issuer names.
2656+
2657+
Finally, to verify that this certificate's signature was produced by a private key
2658+
corresponding to `otherCert`'s public key use [`x509.verify(publicKey)`][]
2659+
with `otherCert`'s public key represented as a [`KeyObject`][]
2660+
like so
2661+
2662+
```js
2663+
if (!x509.verify(otherCert.publicKey)) {
2664+
throw new Error('otherCert did not issue x509');
2665+
}
2666+
```
26512667

26522668
### `x509.checkPrivateKey(privateKey)`
26532669

@@ -6187,6 +6203,7 @@ See the [list of SSL OP Flags][] for details.
61876203
[`verify.update()`]: #verifyupdatedata-inputencoding
61886204
[`verify.verify()`]: #verifyverifyobject-signature-signatureencoding
61896205
[`x509.fingerprint256`]: #x509fingerprint256
6206+
[`x509.verify(publicKey)`]: #x509verifypublickey
61906207
[caveats when using strings as inputs to cryptographic APIs]: #using-strings-as-inputs-to-cryptographic-apis
61916208
[certificate object]: tls.md#certificate-object
61926209
[encoding]: buffer.md#buffers-and-character-encodings

0 commit comments

Comments
 (0)