Skip to content

Commit a3b2012

Browse files
j3lampmarco-ippolito
authored andcommittedJun 17, 2024
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 978ee0a commit a3b2012

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
@@ -3636,6 +3636,217 @@ removed: v15.0.0
36363636

36373637
The native call from `process.cpuUsage` could not be processed.
36383638

3639+
<a id="openssl-error-codes"></a>
3640+
3641+
## OpenSSL Error Codes
3642+
3643+
<a id="Time Validity Errors"></a>
3644+
3645+
### Time Validity Errors
3646+
3647+
<a id="CERT_NOT_YET_VALID"></a>
3648+
3649+
#### `CERT_NOT_YET_VALID`
3650+
3651+
The certificate is not yet valid: the notBefore date is after the current time.
3652+
3653+
<a id="CERT_HAS_EXPIRED"></a>
3654+
3655+
#### `CERT_HAS_EXPIRED`
3656+
3657+
The certificate has expired: the notAfter date is before the current time.
3658+
3659+
<a id="CRL_NOT_YET_VALID"></a>
3660+
3661+
#### `CRL_NOT_YET_VALID`
3662+
3663+
The certificate revocation list (CRL) has a future issue date.
3664+
3665+
<a id="CRL_HAS_EXPIRED"></a>
3666+
3667+
#### `CRL_HAS_EXPIRED`
3668+
3669+
The certificate revocation list (CRL) has expired.
3670+
3671+
<a id="CERT_REVOKED"></a>
3672+
3673+
#### `CERT_REVOKED`
3674+
3675+
The certificate has been revoked; it is on a certificate revocation list (CRL).
3676+
3677+
<a id="Trust or Chain Related Errors"></a>
3678+
3679+
### Trust or Chain Related Errors
3680+
3681+
<a id="UNABLE_TO_GET_ISSUER_CERT"></a>
3682+
3683+
#### `UNABLE_TO_GET_ISSUER_CERT`
3684+
3685+
The issuer certificate of a looked up certificate could not be found. This
3686+
normally means the list of trusted certificates is not complete.
3687+
3688+
<a id="UNABLE_TO_GET_ISSUER_CERT_LOCALLY"></a>
3689+
3690+
#### `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`
3691+
3692+
The certificate’s issuer is not known. This is the case if the issuer is not
3693+
included in the trusted certificate list.
3694+
3695+
<a id="DEPTH_ZERO_SELF_SIGNED_CERT"></a>
3696+
3697+
#### `DEPTH_ZERO_SELF_SIGNED_CERT`
3698+
3699+
The passed certificate is self-signed and the same certificate cannot be found
3700+
in the list of trusted certificates.
3701+
3702+
<a id="SELF_SIGNED_CERT_IN_CHAIN"></a>
3703+
3704+
#### `SELF_SIGNED_CERT_IN_CHAIN`
3705+
3706+
The certificate’s issuer is not known. This is the case if the issuer is not
3707+
included in the trusted certificate list.
3708+
3709+
<a id="CERT_CHAIN_TOO_LONG"></a>
3710+
3711+
#### `CERT_CHAIN_TOO_LONG`
3712+
3713+
The certificate chain length is greater than the maximum depth.
3714+
3715+
<a id="UNABLE_TO_GET_CRL"></a>
3716+
3717+
#### `UNABLE_TO_GET_CRL`
3718+
3719+
The CRL reference by the certificate could not be found.
3720+
3721+
<a id="UNABLE_TO_VERIFY_LEAF_SIGNATURE"></a>
3722+
3723+
#### `UNABLE_TO_VERIFY_LEAF_SIGNATURE`
3724+
3725+
No signatures could be verified because the chain contains only one certificate
3726+
and it is not self signed.
3727+
3728+
<a id="CERT_UNTRUSTED"></a>
3729+
3730+
#### `CERT_UNTRUSTED`
3731+
3732+
The root certificate authority (CA) is not marked as trusted for the specified
3733+
purpose.
3734+
3735+
<a id="Basic Extension Errors"></a>
3736+
3737+
### Basic Extension Errors
3738+
3739+
<a id="INVALID_CA"></a>
3740+
3741+
#### `INVALID_CA`
3742+
3743+
A CA certificate is invalid. Either it is not a CA or its extensions are not
3744+
consistent with the supplied purpose.
3745+
3746+
<a id="PATH_LENGTH_EXCEEDED"></a>
3747+
3748+
#### `PATH_LENGTH_EXCEEDED`
3749+
3750+
The basicConstraints pathlength parameter has been exceeded.
3751+
3752+
<a id="Name Related Errors"></a>
3753+
3754+
### Name Related Errors
3755+
3756+
<a id="HOSTNAME_MISMATCH"></a>
3757+
3758+
#### `HOSTNAME_MISMATCH`
3759+
3760+
Certificate does not match provided name.
3761+
3762+
<a id="Usage and Policy Errors"></a>
3763+
3764+
### Usage and Policy Errors
3765+
3766+
<a id="INVALID_PURPOSE"></a>
3767+
3768+
#### `INVALID_PURPOSE`
3769+
3770+
The supplied certificate cannot be used for the specified purpose.
3771+
3772+
<a id="CERT_REJECTED"></a>
3773+
3774+
#### `CERT_REJECTED`
3775+
3776+
The root CA is marked to reject the specified purpose.
3777+
3778+
<a id="Formatting Errors"></a>
3779+
3780+
### Formatting Errors
3781+
3782+
<a id="CERT_SIGNATURE_FAILURE"></a>
3783+
3784+
#### `CERT_SIGNATURE_FAILURE`
3785+
3786+
The signature of the certificate is invalid.
3787+
3788+
<a id="CRL_SIGNATURE_FAILURE"></a>
3789+
3790+
#### `CRL_SIGNATURE_FAILURE`
3791+
3792+
The signature of the certificate revocation list (CRL) is invalid.
3793+
3794+
<a id="ERROR_IN_CERT_NOT_BEFORE_FIELD"></a>
3795+
3796+
#### `ERROR_IN_CERT_NOT_BEFORE_FIELD`
3797+
3798+
The certificate notBefore field contains an invalid time.
3799+
3800+
<a id="ERROR_IN_CERT_NOT_AFTER_FIELD"></a>
3801+
3802+
#### `ERROR_IN_CERT_NOT_AFTER_FIELD`
3803+
3804+
The certificate notAfter field contains an invalid time.
3805+
3806+
<a id="ERROR_IN_CRL_LAST_UPDATE_FIELD"></a>
3807+
3808+
#### `ERROR_IN_CRL_LAST_UPDATE_FIELD`
3809+
3810+
The CRL lastUpdate field contains an invalid time.
3811+
3812+
<a id="ERROR_IN_CRL_NEXT_UPDATE_FIELD"></a>
3813+
3814+
#### `ERROR_IN_CRL_NEXT_UPDATE_FIELD`
3815+
3816+
The CRL nextUpdate field contains an invalid time.
3817+
3818+
<a id="UNABLE_TO_DECRYPT_CERT_SIGNATURE"></a>
3819+
3820+
#### `UNABLE_TO_DECRYPT_CERT_SIGNATURE`
3821+
3822+
The certificate signature could not be decrypted. This means that the actual
3823+
signature value could not be determined rather than it not matching the expected
3824+
value, this is only meaningful for RSA keys.
3825+
3826+
<a id="UNABLE_TO_DECRYPT_CRL_SIGNATURE"></a>
3827+
3828+
#### `UNABLE_TO_DECRYPT_CRL_SIGNATURE`
3829+
3830+
The certificate revocation list (CRL) signature could not be decrypted: this
3831+
means that the actual signature value could not be determined rather than it not
3832+
matching the expected value.
3833+
3834+
<a id="UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY"></a>
3835+
3836+
#### `UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY`
3837+
3838+
The public key in the certificate SubjectPublicKeyInfo could not be read.
3839+
3840+
<a id="Other OpenSSL Errors"></a>
3841+
3842+
### Other OpenSSL Errors
3843+
3844+
<a id="OUT_OF_MEM"></a>
3845+
3846+
#### `OUT_OF_MEM`
3847+
3848+
An error occurred trying to allocate memory. This should never happen.
3849+
36393850
[ES Module]: esm.md
36403851
[ICU]: intl.md#internationalization-support
36413852
[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)
Please sign in to comment.