Botan 2.19.5 Crypto and TLS for C&

cert_status.cpp
Go to the documentation of this file.
1/*
2* (C) 2016 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#include <botan/pkix_enums.h>
8
9 namespace Botan {
10
11 const char* to_string(Certificate_Status_Code code)
12 {
13 switch(code)
14 {
15 case Certificate_Status_Code::VERIFIED:
16 return "Verified";
17 case Certificate_Status_Code::OCSP_RESPONSE_GOOD:
18 return "OCSP response accepted as affirming unrevoked status for certificate";
19 case Certificate_Status_Code::OCSP_SIGNATURE_OK:
20 return "Signature on OCSP response was found valid";
21 case Certificate_Status_Code::VALID_CRL_CHECKED:
22 return "Valid CRL examined";
23
24 case Certificate_Status_Code::CERT_SERIAL_NEGATIVE:
25 return "Certificate serial number is negative";
26 case Certificate_Status_Code::DN_TOO_LONG:
27 return "Distinguished name too long";
28 case Certificate_Status_Code::OCSP_NO_REVOCATION_URL:
29 return "OCSP URL not available";
30 case Certificate_Status_Code::OCSP_SERVER_NOT_AVAILABLE:
31 return "OCSP server not available";
32
33 case Certificate_Status_Code::NO_REVOCATION_DATA:
34 return "No revocation data";
35 case Certificate_Status_Code::SIGNATURE_METHOD_TOO_WEAK:
36 return "Signature method too weak";
37 case Certificate_Status_Code::UNTRUSTED_HASH:
38 return "Hash function used is considered too weak for security";
39
40 case Certificate_Status_Code::CERT_NOT_YET_VALID:
41 return "Certificate is not yet valid";
42 case Certificate_Status_Code::CERT_HAS_EXPIRED:
43 return "Certificate has expired";
44 case Certificate_Status_Code::OCSP_NOT_YET_VALID:
45 return "OCSP is not yet valid";
46 case Certificate_Status_Code::OCSP_HAS_EXPIRED:
47 return "OCSP response has expired";
48 case Certificate_Status_Code::OCSP_IS_TOO_OLD:
49 return "OCSP response is too old";
50 case Certificate_Status_Code::CRL_NOT_YET_VALID:
51 return "CRL response is not yet valid";
52 case Certificate_Status_Code::CRL_HAS_EXPIRED:
53 return "CRL has expired";
54
55 case Certificate_Status_Code::CERT_ISSUER_NOT_FOUND:
56 return "Certificate issuer not found";
57 case Certificate_Status_Code::CANNOT_ESTABLISH_TRUST:
58 return "Cannot establish trust";
59 case Certificate_Status_Code::CERT_CHAIN_LOOP:
60 return "Loop in certificate chain";
61 case Certificate_Status_Code::CHAIN_LACKS_TRUST_ROOT:
62 return "Certificate chain does not end in a CA certificate";
63 case Certificate_Status_Code::CHAIN_NAME_MISMATCH:
64 return "Certificate issuer does not match subject of issuing cert";
65
66 case Certificate_Status_Code::POLICY_ERROR:
67 return "Certificate policy error";
68 case Certificate_Status_Code::DUPLICATE_CERT_POLICY:
69 return "Certificate contains duplicate policy";
70 case Certificate_Status_Code::INVALID_USAGE:
71 return "Certificate does not allow the requested usage";
72 case Certificate_Status_Code::CERT_CHAIN_TOO_LONG:
73 return "Certificate chain too long";
74 case Certificate_Status_Code::CA_CERT_NOT_FOR_CERT_ISSUER:
75 return "CA certificate not allowed to issue certs";
76 case Certificate_Status_Code::CA_CERT_NOT_FOR_CRL_ISSUER:
77 return "CA certificate not allowed to issue CRLs";
78 case Certificate_Status_Code::NO_MATCHING_CRLDP:
79 return "No CRL with matching distribution point for certificate";
80 case Certificate_Status_Code::OCSP_CERT_NOT_LISTED:
81 return "OCSP cert not listed";
82 case Certificate_Status_Code::OCSP_BAD_STATUS:
83 return "OCSP bad status";
84 case Certificate_Status_Code::CERT_NAME_NOMATCH:
85 return "Certificate does not match provided name";
86 case Certificate_Status_Code::NAME_CONSTRAINT_ERROR:
87 return "Certificate does not pass name constraint";
88 case Certificate_Status_Code::UNKNOWN_CRITICAL_EXTENSION:
89 return "Unknown critical extension encountered";
90 case Certificate_Status_Code::DUPLICATE_CERT_EXTENSION:
91 return "Duplicate certificate extension encountered";
92 case Certificate_Status_Code::EXT_IN_V1_V2_CERT:
93 return "Encountered extension in certificate with version that does not allow it";
94 case Certificate_Status_Code::V2_IDENTIFIERS_IN_V1_CERT:
95 return "Encountered v2 identifiers in v1 certificate";
96 case Certificate_Status_Code::OCSP_SIGNATURE_ERROR:
97 return "OCSP signature error";
98 case Certificate_Status_Code::OCSP_ISSUER_NOT_FOUND:
99 return "Unable to find certificate issusing OCSP response";
100 case Certificate_Status_Code::OCSP_RESPONSE_MISSING_KEYUSAGE:
101 return "OCSP issuer's keyusage prohibits OCSP";
102 case Certificate_Status_Code::OCSP_RESPONSE_INVALID:
103 return "OCSP parsing valid";
104 case Certificate_Status_Code::OCSP_NO_HTTP:
105 return "OCSP requests not available, no HTTP support compiled in";
106 case Certificate_Status_Code::CERT_IS_REVOKED:
107 return "Certificate is revoked";
108 case Certificate_Status_Code::CRL_BAD_SIGNATURE:
109 return "CRL bad signature";
110 case Certificate_Status_Code::SIGNATURE_ERROR:
111 return "Signature error";
112 case Certificate_Status_Code::CERT_PUBKEY_INVALID:
113 return "Certificate public key invalid";
114 case Certificate_Status_Code::SIGNATURE_ALGO_UNKNOWN:
115 return "Certificate signed with unknown/unavailable algorithm";
116 case Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS:
117 return "Certificate signature has invalid parameters";
118
119 // intentionally no default so we are warned if new enum values are added
120 }
121
122 return nullptr;
123 }
124
125}
Botan
Definition: alg_id.cpp:13
Botan::to_string
std::string to_string(ErrorType type)
Convert an ErrorType to string.
Definition: exceptn.cpp:11
Botan::Certificate_Status_Code
Certificate_Status_Code
Definition: pkix_enums.h:17
Botan::Certificate_Status_Code::DUPLICATE_CERT_EXTENSION
@ DUPLICATE_CERT_EXTENSION
Botan::Certificate_Status_Code::CERT_SERIAL_NEGATIVE
@ CERT_SERIAL_NEGATIVE
Botan::Certificate_Status_Code::INVALID_USAGE
@ INVALID_USAGE
Botan::Certificate_Status_Code::NAME_CONSTRAINT_ERROR
@ NAME_CONSTRAINT_ERROR
Botan::Certificate_Status_Code::OCSP_RESPONSE_MISSING_KEYUSAGE
@ OCSP_RESPONSE_MISSING_KEYUSAGE
Botan::Certificate_Status_Code::OCSP_BAD_STATUS
@ OCSP_BAD_STATUS
Botan::Certificate_Status_Code::DUPLICATE_CERT_POLICY
@ DUPLICATE_CERT_POLICY
Botan::Certificate_Status_Code::CERT_PUBKEY_INVALID
@ CERT_PUBKEY_INVALID
Botan::Certificate_Status_Code::CERT_NAME_NOMATCH
@ CERT_NAME_NOMATCH
Botan::Certificate_Status_Code::VERIFIED
@ VERIFIED
Botan::Certificate_Status_Code::CA_CERT_NOT_FOR_CRL_ISSUER
@ CA_CERT_NOT_FOR_CRL_ISSUER
Botan::Certificate_Status_Code::CA_CERT_NOT_FOR_CERT_ISSUER
@ CA_CERT_NOT_FOR_CERT_ISSUER
Botan::Certificate_Status_Code::OCSP_NO_REVOCATION_URL
@ OCSP_NO_REVOCATION_URL
Botan::Certificate_Status_Code::CRL_BAD_SIGNATURE
@ CRL_BAD_SIGNATURE
Botan::Certificate_Status_Code::SIGNATURE_ERROR
@ SIGNATURE_ERROR
Botan::Certificate_Status_Code::OCSP_CERT_NOT_LISTED
@ OCSP_CERT_NOT_LISTED
Botan::Certificate_Status_Code::CRL_HAS_EXPIRED
@ CRL_HAS_EXPIRED
Botan::Certificate_Status_Code::CERT_CHAIN_LOOP
@ CERT_CHAIN_LOOP
Botan::Certificate_Status_Code::OCSP_RESPONSE_INVALID
@ OCSP_RESPONSE_INVALID
Botan::Certificate_Status_Code::OCSP_HAS_EXPIRED
@ OCSP_HAS_EXPIRED
Botan::Certificate_Status_Code::OCSP_SERVER_NOT_AVAILABLE
@ OCSP_SERVER_NOT_AVAILABLE
Botan::Certificate_Status_Code::OCSP_NO_HTTP
@ OCSP_NO_HTTP
Botan::Certificate_Status_Code::UNTRUSTED_HASH
@ UNTRUSTED_HASH
Botan::Certificate_Status_Code::VALID_CRL_CHECKED
@ VALID_CRL_CHECKED
Botan::Certificate_Status_Code::CERT_IS_REVOKED
@ CERT_IS_REVOKED
Botan::Certificate_Status_Code::CERT_HAS_EXPIRED
@ CERT_HAS_EXPIRED
Botan::Certificate_Status_Code::OCSP_SIGNATURE_ERROR
@ OCSP_SIGNATURE_ERROR
Botan::Certificate_Status_Code::OCSP_IS_TOO_OLD
@ OCSP_IS_TOO_OLD
Botan::Certificate_Status_Code::DN_TOO_LONG
@ DN_TOO_LONG
Botan::Certificate_Status_Code::POLICY_ERROR
@ POLICY_ERROR
Botan::Certificate_Status_Code::UNKNOWN_CRITICAL_EXTENSION
@ UNKNOWN_CRITICAL_EXTENSION
Botan::Certificate_Status_Code::OCSP_RESPONSE_GOOD
@ OCSP_RESPONSE_GOOD
Botan::Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS
@ SIGNATURE_ALGO_BAD_PARAMS
Botan::Certificate_Status_Code::SIGNATURE_ALGO_UNKNOWN
@ SIGNATURE_ALGO_UNKNOWN
Botan::Certificate_Status_Code::OCSP_SIGNATURE_OK
@ OCSP_SIGNATURE_OK
Botan::Certificate_Status_Code::CERT_CHAIN_TOO_LONG
@ CERT_CHAIN_TOO_LONG
Botan::Certificate_Status_Code::NO_REVOCATION_DATA
@ NO_REVOCATION_DATA
Botan::Certificate_Status_Code::CERT_ISSUER_NOT_FOUND
@ CERT_ISSUER_NOT_FOUND
Botan::Certificate_Status_Code::CERT_NOT_YET_VALID
@ CERT_NOT_YET_VALID
Botan::Certificate_Status_Code::CANNOT_ESTABLISH_TRUST
@ CANNOT_ESTABLISH_TRUST
Botan::Certificate_Status_Code::CRL_NOT_YET_VALID
@ CRL_NOT_YET_VALID
Botan::Certificate_Status_Code::OCSP_NOT_YET_VALID
@ OCSP_NOT_YET_VALID
Botan::Certificate_Status_Code::V2_IDENTIFIERS_IN_V1_CERT
@ V2_IDENTIFIERS_IN_V1_CERT
Botan::Certificate_Status_Code::NO_MATCHING_CRLDP
@ NO_MATCHING_CRLDP
Botan::Certificate_Status_Code::EXT_IN_V1_V2_CERT
@ EXT_IN_V1_V2_CERT
Botan::Certificate_Status_Code::OCSP_ISSUER_NOT_FOUND
@ OCSP_ISSUER_NOT_FOUND
Botan::Certificate_Status_Code::SIGNATURE_METHOD_TOO_WEAK
@ SIGNATURE_METHOD_TOO_WEAK
Botan::Certificate_Status_Code::CHAIN_LACKS_TRUST_ROOT
@ CHAIN_LACKS_TRUST_ROOT
Botan::Certificate_Status_Code::CHAIN_NAME_MISMATCH
@ CHAIN_NAME_MISMATCH