Qore Programming Language  1.12.0
ssl_constants.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  ssl_constants.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2022 David Nichols
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_SSL_CONSTANTS_H
33 
34 #define _QORE_SSL_CONSTANTS_H
35 
36 #include <openssl/ssl.h>
37 
38 static inline const char *getSSLCVCode(int code) {
39  switch (code) {
40  case 0:
41  return "X509_V_OK";
42  case 2:
43  return "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT";
44  case 3:
45  return "X509_V_ERR_UNABLE_TO_GET_CRL";
46  case 4:
47  return "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE";
48  case 5:
49  return "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE";
50  case 6:
51  return "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY";
52  case 7:
53  return "X509_V_ERR_CERT_SIGNATURE_FAILURE";
54  case 8:
55  return "X509_V_ERR_CRL_SIGNATURE_FAILURE";
56  case 9:
57  return "X509_V_ERR_CERT_NOT_YET_VALID";
58  case 10:
59  return "X509_V_ERR_CERT_HAS_EXPIRED";
60  case 11:
61  return "X509_V_ERR_CRL_NOT_YET_VALID";
62  case 12:
63  return "X509_V_ERR_CRL_HAS_EXPIRED";
64  case 13:
65  return "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD";
66  case 14:
67  return "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD";
68  case 15:
69  return "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD";
70  case 16:
71  return "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD";
72  case 17:
73  return "X509_V_ERR_OUT_OF_MEM";
74  case 18:
75  return "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT";
76  case 19:
77  return "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN";
78  case 20:
79  return "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY";
80  case 21:
81  return "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE";
82  case 22:
83  return "X509_V_ERR_CERT_CHAIN_TOO_LONG";
84  case 23:
85  return "X509_V_ERR_CERT_REVOKED";
86  case 24:
87  return "X509_V_ERR_INVALID_CA";
88  case 25:
89  return "X509_V_ERR_PATH_LENGTH_EXCEEDED";
90  case 26:
91  return "X509_V_ERR_INVALID_PURPOSE";
92  case 27:
93  return "X509_V_ERR_CERT_UNTRUSTED";
94  case 28:
95  return "X509_V_ERR_CERT_REJECTED";
96  case 29:
97  return "X509_V_ERR_SUBJECT_ISSUER_MISMATCH";
98  case 30:
99  return "X509_V_ERR_AKID_SKID_MISMATCH";
100  case 31:
101  return "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH";
102  case 32:
103  return "X509_V_ERR_KEYUSAGE_NO_CERTSIGN";
104  case 50:
105  return "X509_V_ERR_APPLICATION_VERIFICATION";
106  }
107  return NULL;
108 }
109 
110 #endif