| 1 |
// Copyright (C) 1995-1998 Eric Young ([email protected]) All rights reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
#include <openssl/x509.h> |
| 5 |
|
| 6 |
const char *X509_verify_cert_error_string(long err) { |
| 7 |
switch (err) { |
| 8 |
case X509_V_OK: |
| 9 |
return "ok"; |
| 10 |
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: |
| 11 |
return "unable to get issuer certificate"; |
| 12 |
case X509_V_ERR_UNABLE_TO_GET_CRL: |
| 13 |
return "unable to get certificate CRL"; |
| 14 |
case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: |
| 15 |
return "unable to decrypt certificate's signature"; |
| 16 |
case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: |
| 17 |
return "unable to decrypt CRL's signature"; |
| 18 |
case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: |
| 19 |
return "unable to decode issuer public key"; |
| 20 |
case X509_V_ERR_CERT_SIGNATURE_FAILURE: |
| 21 |
return "certificate signature failure"; |
| 22 |
case X509_V_ERR_CRL_SIGNATURE_FAILURE: |
| 23 |
return "CRL signature failure"; |
| 24 |
case X509_V_ERR_CERT_NOT_YET_VALID: |
| 25 |
return "certificate is not yet valid"; |
| 26 |
case X509_V_ERR_CRL_NOT_YET_VALID: |
| 27 |
return "CRL is not yet valid"; |
| 28 |
case X509_V_ERR_CERT_HAS_EXPIRED: |
| 29 |
return "certificate has expired"; |
| 30 |
case X509_V_ERR_CRL_HAS_EXPIRED: |
| 31 |
return "CRL has expired"; |
| 32 |
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: |
| 33 |
return "format error in certificate's notBefore field"; |
| 34 |
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: |
| 35 |
return "format error in certificate's notAfter field"; |
| 36 |
case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: |
| 37 |
return "format error in CRL's lastUpdate field"; |
| 38 |
case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: |
| 39 |
return "format error in CRL's nextUpdate field"; |
| 40 |
case X509_V_ERR_OUT_OF_MEM: |
| 41 |
return "out of memory"; |
| 42 |
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: |
| 43 |
return "self signed certificate"; |
| 44 |
case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: |
| 45 |
return "self signed certificate in certificate chain"; |
| 46 |
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: |
| 47 |
return "unable to get local issuer certificate"; |
| 48 |
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: |
| 49 |
return "unable to verify the first certificate"; |
| 50 |
case X509_V_ERR_CERT_CHAIN_TOO_LONG: |
| 51 |
return "certificate chain too long"; |
| 52 |
case X509_V_ERR_CERT_REVOKED: |
| 53 |
return "certificate revoked"; |
| 54 |
case X509_V_ERR_INVALID_CA: |
| 55 |
return "invalid CA certificate"; |
| 56 |
case X509_V_ERR_INVALID_NON_CA: |
| 57 |
return "invalid non-CA certificate (has CA markings)"; |
| 58 |
case X509_V_ERR_PATH_LENGTH_EXCEEDED: |
| 59 |
return "path length constraint exceeded"; |
| 60 |
case X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: |
| 61 |
return "proxy path length constraint exceeded"; |
| 62 |
case X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: |
| 63 |
return "proxy certificates not allowed, please set the appropriate flag"; |
| 64 |
case X509_V_ERR_INVALID_PURPOSE: |
| 65 |
return "unsupported certificate purpose"; |
| 66 |
case X509_V_ERR_CERT_UNTRUSTED: |
| 67 |
return "certificate not trusted"; |
| 68 |
case X509_V_ERR_CERT_REJECTED: |
| 69 |
return "certificate rejected"; |
| 70 |
case X509_V_ERR_APPLICATION_VERIFICATION: |
| 71 |
return "application verification failure"; |
| 72 |
case X509_V_ERR_SUBJECT_ISSUER_MISMATCH: |
| 73 |
return "subject issuer mismatch"; |
| 74 |
case X509_V_ERR_AKID_SKID_MISMATCH: |
| 75 |
return "authority and subject key identifier mismatch"; |
| 76 |
case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: |
| 77 |
return "authority and issuer serial number mismatch"; |
| 78 |
case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: |
| 79 |
return "key usage does not include certificate signing"; |
| 80 |
case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: |
| 81 |
return "unable to get CRL issuer certificate"; |
| 82 |
case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: |
| 83 |
return "unhandled critical extension"; |
| 84 |
case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: |
| 85 |
return "key usage does not include CRL signing"; |
| 86 |
case X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: |
| 87 |
return "key usage does not include digital signature"; |
| 88 |
case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: |
| 89 |
return "unhandled critical CRL extension"; |
| 90 |
case X509_V_ERR_INVALID_EXTENSION: |
| 91 |
return "invalid or inconsistent certificate extension"; |
| 92 |
case X509_V_ERR_INVALID_POLICY_EXTENSION: |
| 93 |
return "invalid or inconsistent certificate policy extension"; |
| 94 |
case X509_V_ERR_NO_EXPLICIT_POLICY: |
| 95 |
return "no explicit policy"; |
| 96 |
case X509_V_ERR_DIFFERENT_CRL_SCOPE: |
| 97 |
return "Different CRL scope"; |
| 98 |
case X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: |
| 99 |
return "Unsupported extension feature"; |
| 100 |
case X509_V_ERR_UNNESTED_RESOURCE: |
| 101 |
return "RFC 3779 resource not subset of parent's resources"; |
| 102 |
|
| 103 |
case X509_V_ERR_PERMITTED_VIOLATION: |
| 104 |
return "permitted subtree violation"; |
| 105 |
case X509_V_ERR_EXCLUDED_VIOLATION: |
| 106 |
return "excluded subtree violation"; |
| 107 |
case X509_V_ERR_SUBTREE_MINMAX: |
| 108 |
return "name constraints minimum and maximum not supported"; |
| 109 |
case X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: |
| 110 |
return "unsupported name constraint type"; |
| 111 |
case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: |
| 112 |
return "unsupported or invalid name constraint syntax"; |
| 113 |
case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: |
| 114 |
return "unsupported or invalid name syntax"; |
| 115 |
case X509_V_ERR_CRL_PATH_VALIDATION_ERROR: |
| 116 |
return "CRL path validation error"; |
| 117 |
|
| 118 |
case X509_V_ERR_HOSTNAME_MISMATCH: |
| 119 |
return "Hostname mismatch"; |
| 120 |
case X509_V_ERR_EMAIL_MISMATCH: |
| 121 |
return "Email address mismatch"; |
| 122 |
case X509_V_ERR_IP_ADDRESS_MISMATCH: |
| 123 |
return "IP address mismatch"; |
| 124 |
|
| 125 |
case X509_V_ERR_INVALID_CALL: |
| 126 |
return "Invalid certificate verification context"; |
| 127 |
case X509_V_ERR_STORE_LOOKUP: |
| 128 |
return "Issuer certificate lookup error"; |
| 129 |
case X509_V_UNABLE_TO_GET_CERTS_PUBLIC_KEY: |
| 130 |
return "Unable to get leaf certificate's public key"; |
| 131 |
case X509_V_ERR_EC_KEY_EXPLICIT_PARAMS: |
| 132 |
return "Certificate public key has explicit ECC parameters"; |
| 133 |
|
| 134 |
default: |
| 135 |
return "unknown certificate verification error"; |
| 136 |
} |
| 137 |
} |