Botan 2.19.5 Crypto and TLS for C&

pkix_enums.h
Go to the documentation of this file.
1/*
2* (C) 2013 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_X509_PKIX_ENUMS_H_
8#define BOTAN_X509_PKIX_ENUMS_H_
9
10#include <botan/types.h>
11
12 namespace Botan {
13
14/**
15* Certificate validation status code
16*/
17 enum class Certificate_Status_Code {
18 OK = 0,
19 VERIFIED = 0,
20
21 // Revocation status
22 OCSP_RESPONSE_GOOD = 1,
23 OCSP_SIGNATURE_OK = 2,
24 VALID_CRL_CHECKED = 3,
25 OCSP_NO_HTTP = 4,
26
27 // Warnings
28 FIRST_WARNING_STATUS = 500,
29 CERT_SERIAL_NEGATIVE = 500,
30 DN_TOO_LONG = 501,
31 OCSP_NO_REVOCATION_URL = 502,
32 OCSP_SERVER_NOT_AVAILABLE = 503,
33
34 // Typo versions of above - will be removed in future major release
35 OSCP_NO_REVOCATION_URL = 502,
36 OSCP_SERVER_NOT_AVAILABLE = 503,
37
38 // Errors
39 FIRST_ERROR_STATUS = 1000,
40
41 SIGNATURE_METHOD_TOO_WEAK = 1000,
42 UNTRUSTED_HASH = 1001,
43 NO_REVOCATION_DATA = 1002,
44 NO_MATCHING_CRLDP = 1003,
45
46 // Time problems
47 CERT_NOT_YET_VALID = 2000,
48 CERT_HAS_EXPIRED = 2001,
49 OCSP_NOT_YET_VALID = 2002,
50 OCSP_HAS_EXPIRED = 2003,
51 CRL_NOT_YET_VALID = 2004,
52 CRL_HAS_EXPIRED = 2005,
53 OCSP_IS_TOO_OLD = 2006,
54
55 // Chain generation problems
56 CERT_ISSUER_NOT_FOUND = 3000,
57 CANNOT_ESTABLISH_TRUST = 3001,
58 CERT_CHAIN_LOOP = 3002,
59 CHAIN_LACKS_TRUST_ROOT = 3003,
60 CHAIN_NAME_MISMATCH = 3004,
61
62 // Validation errors
63 POLICY_ERROR = 4000,
64 INVALID_USAGE = 4001,
65 CERT_CHAIN_TOO_LONG = 4002,
66 CA_CERT_NOT_FOR_CERT_ISSUER = 4003,
67 NAME_CONSTRAINT_ERROR = 4004,
68
69 // Revocation errors
70 CA_CERT_NOT_FOR_CRL_ISSUER = 4005,
71 OCSP_CERT_NOT_LISTED = 4006,
72 OCSP_BAD_STATUS = 4007,
73
74 // Other problems
75 CERT_NAME_NOMATCH = 4008,
76 UNKNOWN_CRITICAL_EXTENSION = 4009,
77 DUPLICATE_CERT_EXTENSION = 4010,
78 OCSP_SIGNATURE_ERROR = 4501,
79 OCSP_ISSUER_NOT_FOUND = 4502,
80 OCSP_RESPONSE_MISSING_KEYUSAGE = 4503,
81 OCSP_RESPONSE_INVALID = 4504,
82 EXT_IN_V1_V2_CERT = 4505,
83 DUPLICATE_CERT_POLICY = 4506,
84 V2_IDENTIFIERS_IN_V1_CERT = 4507,
85
86 // Hard failures
87 CERT_IS_REVOKED = 5000,
88 CRL_BAD_SIGNATURE = 5001,
89 SIGNATURE_ERROR = 5002,
90 CERT_PUBKEY_INVALID = 5003,
91 SIGNATURE_ALGO_UNKNOWN = 5004,
92 SIGNATURE_ALGO_BAD_PARAMS = 5005
93};
94
95/**
96* Convert a status code to a human readable diagnostic message
97* @param code the certifcate status
98* @return string literal constant, or nullptr if code unknown
99*/
100 BOTAN_PUBLIC_API(2,0) const char* to_string(Certificate_Status_Code code);
101
102/**
103* X.509v3 Key Constraints.
104* If updating update copy in ffi.h
105*/
106enum Key_Constraints {
107 NO_CONSTRAINTS = 0,
108 DIGITAL_SIGNATURE = 1 << 15,
109 NON_REPUDIATION = 1 << 14,
110 KEY_ENCIPHERMENT = 1 << 13,
111 DATA_ENCIPHERMENT = 1 << 12,
112 KEY_AGREEMENT = 1 << 11,
113 KEY_CERT_SIGN = 1 << 10,
114 CRL_SIGN = 1 << 9,
115 ENCIPHER_ONLY = 1 << 8,
116 DECIPHER_ONLY = 1 << 7
117};
118
119/**
120* X.509v2 CRL Reason Code.
121* This will become an enum class in a future major release
122*/
123 enum CRL_Code : uint32_t {
124 UNSPECIFIED = 0,
125 KEY_COMPROMISE = 1,
126 CA_COMPROMISE = 2,
127 AFFILIATION_CHANGED = 3,
128 SUPERSEDED = 4,
129 CESSATION_OF_OPERATION = 5,
130 CERTIFICATE_HOLD = 6,
131 REMOVE_FROM_CRL = 8,
132 PRIVLEDGE_WITHDRAWN = 9,
133 PRIVILEGE_WITHDRAWN = 9,
134 AA_COMPROMISE = 10,
135
136 DELETE_CRL_ENTRY = 0xFF00,
137 OCSP_GOOD = 0xFF01,
138 OCSP_UNKNOWN = 0xFF02
139};
140
141}
142
143#endif
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan
Definition: alg_id.cpp:13
Botan::CRL_Code
CRL_Code
Definition: pkix_enums.h:123
Botan::OCSP_GOOD
@ OCSP_GOOD
Definition: pkix_enums.h:137
Botan::PRIVLEDGE_WITHDRAWN
@ PRIVLEDGE_WITHDRAWN
Definition: pkix_enums.h:132
Botan::OCSP_UNKNOWN
@ OCSP_UNKNOWN
Definition: pkix_enums.h:138
Botan::AFFILIATION_CHANGED
@ AFFILIATION_CHANGED
Definition: pkix_enums.h:127
Botan::KEY_COMPROMISE
@ KEY_COMPROMISE
Definition: pkix_enums.h:125
Botan::UNSPECIFIED
@ UNSPECIFIED
Definition: pkix_enums.h:124
Botan::SUPERSEDED
@ SUPERSEDED
Definition: pkix_enums.h:128
Botan::AA_COMPROMISE
@ AA_COMPROMISE
Definition: pkix_enums.h:134
Botan::CA_COMPROMISE
@ CA_COMPROMISE
Definition: pkix_enums.h:126
Botan::CESSATION_OF_OPERATION
@ CESSATION_OF_OPERATION
Definition: pkix_enums.h:129
Botan::REMOVE_FROM_CRL
@ REMOVE_FROM_CRL
Definition: pkix_enums.h:131
Botan::CERTIFICATE_HOLD
@ CERTIFICATE_HOLD
Definition: pkix_enums.h:130
Botan::PRIVILEGE_WITHDRAWN
@ PRIVILEGE_WITHDRAWN
Definition: pkix_enums.h:133
Botan::DELETE_CRL_ENTRY
@ DELETE_CRL_ENTRY
Definition: pkix_enums.h:136
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::FIRST_WARNING_STATUS
@ FIRST_WARNING_STATUS
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::OSCP_NO_REVOCATION_URL
@ OSCP_NO_REVOCATION_URL
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::FIRST_ERROR_STATUS
@ FIRST_ERROR_STATUS
Botan::Certificate_Status_Code::CERT_IS_REVOKED
@ CERT_IS_REVOKED
Botan::Certificate_Status_Code::CERT_HAS_EXPIRED
@ CERT_HAS_EXPIRED
Botan::Certificate_Status_Code::OSCP_SERVER_NOT_AVAILABLE
@ OSCP_SERVER_NOT_AVAILABLE
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
Botan::Key_Constraints
Key_Constraints
Definition: pkix_enums.h:106
Botan::DATA_ENCIPHERMENT
@ DATA_ENCIPHERMENT
Definition: pkix_enums.h:111
Botan::CRL_SIGN
@ CRL_SIGN
Definition: pkix_enums.h:114
Botan::KEY_CERT_SIGN
@ KEY_CERT_SIGN
Definition: pkix_enums.h:113
Botan::NO_CONSTRAINTS
@ NO_CONSTRAINTS
Definition: pkix_enums.h:107
Botan::ENCIPHER_ONLY
@ ENCIPHER_ONLY
Definition: pkix_enums.h:115
Botan::DIGITAL_SIGNATURE
@ DIGITAL_SIGNATURE
Definition: pkix_enums.h:108
Botan::KEY_AGREEMENT
@ KEY_AGREEMENT
Definition: pkix_enums.h:112
Botan::DECIPHER_ONLY
@ DECIPHER_ONLY
Definition: pkix_enums.h:116
Botan::KEY_ENCIPHERMENT
@ KEY_ENCIPHERMENT
Definition: pkix_enums.h:110
Botan::NON_REPUDIATION
@ NON_REPUDIATION
Definition: pkix_enums.h:109