Skip to content

Commit 562a019

Browse files
j3lamptargos
authored andcommitted
doc: add OpenSSL errors to API docs
Fixes: #33705 PR-URL: #34213 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parent 9c76c95 commit 562a019

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed

doc/api/errors.md

+211
Original file line numberDiff line numberDiff line change
@@ -3715,6 +3715,217 @@ removed: v15.0.0
37153715

37163716
The native call from `process.cpuUsage` could not be processed.
37173717

3718+
<a id="openssl-error-codes"></a>
3719+
3720+
## OpenSSL Error Codes
3721+
3722+
<a id="Time Validity Errors"></a>
3723+
3724+
### Time Validity Errors
3725+
3726+
<a id="CERT_NOT_YET_VALID"></a>
3727+
3728+
#### `CERT_NOT_YET_VALID`
3729+
3730+
The certificate is not yet valid: the notBefore date is after the current time.
3731+
3732+
<a id="CERT_HAS_EXPIRED"></a>
3733+
3734+
#### `CERT_HAS_EXPIRED`
3735+
3736+
The certificate has expired: the notAfter date is before the current time.
3737+
3738+
<a id="CRL_NOT_YET_VALID"></a>
3739+
3740+
#### `CRL_NOT_YET_VALID`
3741+
3742+
The certificate revocation list (CRL) has a future issue date.
3743+
3744+
<a id="CRL_HAS_EXPIRED"></a>
3745+
3746+
#### `CRL_HAS_EXPIRED`
3747+
3748+
The certificate revocation list (CRL) has expired.
3749+
3750+
<a id="CERT_REVOKED"></a>
3751+
3752+
#### `CERT_REVOKED`
3753+
3754+
The certificate has been revoked; it is on a certificate revocation list (CRL).
3755+
3756+
<a id="Trust or Chain Related Errors"></a>
3757+
3758+
### Trust or Chain Related Errors
3759+
3760+
<a id="UNABLE_TO_GET_ISSUER_CERT"></a>
3761+
3762+
#### `UNABLE_TO_GET_ISSUER_CERT`
3763+
3764+
The issuer certificate of a looked up certificate could not be found. This
3765+
normally means the list of trusted certificates is not complete.
3766+
3767+
<a id="UNABLE_TO_GET_ISSUER_CERT_LOCALLY"></a>
3768+
3769+
#### `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`
3770+
3771+
The certificate’s issuer is not known. This is the case if the issuer is not
3772+
included in the trusted certificate list.
3773+
3774+
<a id="DEPTH_ZERO_SELF_SIGNED_CERT"></a>
3775+
3776+
#### `DEPTH_ZERO_SELF_SIGNED_CERT`
3777+
3778+
The passed certificate is self-signed and the same certificate cannot be found
3779+
in the list of trusted certificates.
3780+
3781+
<a id="SELF_SIGNED_CERT_IN_CHAIN"></a>
3782+
3783+
#### `SELF_SIGNED_CERT_IN_CHAIN`
3784+
3785+
The certificate’s issuer is not known. This is the case if the issuer is not
3786+
included in the trusted certificate list.
3787+
3788+
<a id="CERT_CHAIN_TOO_LONG"></a>
3789+
3790+
#### `CERT_CHAIN_TOO_LONG`
3791+
3792+
The certificate chain length is greater than the maximum depth.
3793+
3794+
<a id="UNABLE_TO_GET_CRL"></a>
3795+
3796+
#### `UNABLE_TO_GET_CRL`
3797+
3798+
The CRL reference by the certificate could not be found.
3799+
3800+
<a id="UNABLE_TO_VERIFY_LEAF_SIGNATURE"></a>
3801+
3802+
#### `UNABLE_TO_VERIFY_LEAF_SIGNATURE`
3803+
3804+
No signatures could be verified because the chain contains only one certificate
3805+
and it is not self signed.
3806+
3807+
<a id="CERT_UNTRUSTED"></a>
3808+
3809+
#### `CERT_UNTRUSTED`
3810+
3811+
The root certificate authority (CA) is not marked as trusted for the specified
3812+
purpose.
3813+
3814+
<a id="Basic Extension Errors"></a>
3815+
3816+
### Basic Extension Errors
3817+
3818+
<a id="INVALID_CA"></a>
3819+
3820+
#### `INVALID_CA`
3821+
3822+
A CA certificate is invalid. Either it is not a CA or its extensions are not
3823+
consistent with the supplied purpose.
3824+
3825+
<a id="PATH_LENGTH_EXCEEDED"></a>
3826+
3827+
#### `PATH_LENGTH_EXCEEDED`
3828+
3829+
The basicConstraints pathlength parameter has been exceeded.
3830+
3831+
<a id="Name Related Errors"></a>
3832+
3833+
### Name Related Errors
3834+
3835+
<a id="HOSTNAME_MISMATCH"></a>
3836+
3837+
#### `HOSTNAME_MISMATCH`
3838+
3839+
Certificate does not match provided name.
3840+
3841+
<a id="Usage and Policy Errors"></a>
3842+
3843+
### Usage and Policy Errors
3844+
3845+
<a id="INVALID_PURPOSE"></a>
3846+
3847+
#### `INVALID_PURPOSE`
3848+
3849+
The supplied certificate cannot be used for the specified purpose.
3850+
3851+
<a id="CERT_REJECTED"></a>
3852+
3853+
#### `CERT_REJECTED`
3854+
3855+
The root CA is marked to reject the specified purpose.
3856+
3857+
<a id="Formatting Errors"></a>
3858+
3859+
### Formatting Errors
3860+
3861+
<a id="CERT_SIGNATURE_FAILURE"></a>
3862+
3863+
#### `CERT_SIGNATURE_FAILURE`
3864+
3865+
The signature of the certificate is invalid.
3866+
3867+
<a id="CRL_SIGNATURE_FAILURE"></a>
3868+
3869+
#### `CRL_SIGNATURE_FAILURE`
3870+
3871+
The signature of the certificate revocation list (CRL) is invalid.
3872+
3873+
<a id="ERROR_IN_CERT_NOT_BEFORE_FIELD"></a>
3874+
3875+
#### `ERROR_IN_CERT_NOT_BEFORE_FIELD`
3876+
3877+
The certificate notBefore field contains an invalid time.
3878+
3879+
<a id="ERROR_IN_CERT_NOT_AFTER_FIELD"></a>
3880+
3881+
#### `ERROR_IN_CERT_NOT_AFTER_FIELD`
3882+
3883+
The certificate notAfter field contains an invalid time.
3884+
3885+
<a id="ERROR_IN_CRL_LAST_UPDATE_FIELD"></a>
3886+
3887+
#### `ERROR_IN_CRL_LAST_UPDATE_FIELD`
3888+
3889+
The CRL lastUpdate field contains an invalid time.
3890+
3891+
<a id="ERROR_IN_CRL_NEXT_UPDATE_FIELD"></a>
3892+
3893+
#### `ERROR_IN_CRL_NEXT_UPDATE_FIELD`
3894+
3895+
The CRL nextUpdate field contains an invalid time.
3896+
3897+
<a id="UNABLE_TO_DECRYPT_CERT_SIGNATURE"></a>
3898+
3899+
#### `UNABLE_TO_DECRYPT_CERT_SIGNATURE`
3900+
3901+
The certificate signature could not be decrypted. This means that the actual
3902+
signature value could not be determined rather than it not matching the expected
3903+
value, this is only meaningful for RSA keys.
3904+
3905+
<a id="UNABLE_TO_DECRYPT_CRL_SIGNATURE"></a>
3906+
3907+
#### `UNABLE_TO_DECRYPT_CRL_SIGNATURE`
3908+
3909+
The certificate revocation list (CRL) signature could not be decrypted: this
3910+
means that the actual signature value could not be determined rather than it not
3911+
matching the expected value.
3912+
3913+
<a id="UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY"></a>
3914+
3915+
#### `UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY`
3916+
3917+
The public key in the certificate SubjectPublicKeyInfo could not be read.
3918+
3919+
<a id="Other OpenSSL Errors"></a>
3920+
3921+
### Other OpenSSL Errors
3922+
3923+
<a id="OUT_OF_MEM"></a>
3924+
3925+
#### `OUT_OF_MEM`
3926+
3927+
An error occurred trying to allocate memory. This should never happen.
3928+
37183929
[ES Module]: esm.md
37193930
[ICU]: intl.md#internationalization-support
37203931
[JSON Web Key Elliptic Curve Registry]: https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve

src/crypto/crypto_common.cc

+2
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ bool SetGroups(SecureContext* sc, const char* groups) {
209209
return SSL_CTX_set1_groups_list(sc->ctx().get(), groups) == 1;
210210
}
211211

212+
// When adding or removing errors below, please also update the list in the API
213+
// documentation. See the "OpenSSL Error Codes" section of doc/api/errors.md
212214
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
213215
const char* code = "UNSPECIFIED";
214216
#define CASE_X509_ERR(CODE) case X509_V_ERR_##CODE: code = #CODE; break;

0 commit comments

Comments
 (0)