1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=32b942f6b50b842ddec08addc2b5794f2a272dbe$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_values_capi.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /// 51 // Structure representing the issuer or subject field of an X.509 certificate. 52 /// 53 typedef struct _cef_x509cert_principal_t { 54 /// 55 // Base structure. 56 /// 57 cef_base_ref_counted_t base; 58 59 /// 60 // Returns a name that can be used to represent the issuer. It tries in this 61 // order: Common Name (CN), Organization Name (O) and Organizational Unit Name 62 // (OU) and returns the first non-NULL one found. 63 /// 64 // The resulting string must be freed by calling cef_string_userfree_free(). 65 cef_string_userfree_t(CEF_CALLBACK* get_display_name)( 66 struct _cef_x509cert_principal_t* self); 67 68 /// 69 // Returns the common name. 70 /// 71 // The resulting string must be freed by calling cef_string_userfree_free(). 72 cef_string_userfree_t(CEF_CALLBACK* get_common_name)( 73 struct _cef_x509cert_principal_t* self); 74 75 /// 76 // Returns the locality name. 77 /// 78 // The resulting string must be freed by calling cef_string_userfree_free(). 79 cef_string_userfree_t(CEF_CALLBACK* get_locality_name)( 80 struct _cef_x509cert_principal_t* self); 81 82 /// 83 // Returns the state or province name. 84 /// 85 // The resulting string must be freed by calling cef_string_userfree_free(). 86 cef_string_userfree_t(CEF_CALLBACK* get_state_or_province_name)( 87 struct _cef_x509cert_principal_t* self); 88 89 /// 90 // Returns the country name. 91 /// 92 // The resulting string must be freed by calling cef_string_userfree_free(). 93 cef_string_userfree_t(CEF_CALLBACK* get_country_name)( 94 struct _cef_x509cert_principal_t* self); 95 96 /// 97 // Retrieve the list of street addresses. 98 /// 99 void(CEF_CALLBACK* get_street_addresses)( 100 struct _cef_x509cert_principal_t* self, 101 cef_string_list_t addresses); 102 103 /// 104 // Retrieve the list of organization names. 105 /// 106 void(CEF_CALLBACK* get_organization_names)( 107 struct _cef_x509cert_principal_t* self, 108 cef_string_list_t names); 109 110 /// 111 // Retrieve the list of organization unit names. 112 /// 113 void(CEF_CALLBACK* get_organization_unit_names)( 114 struct _cef_x509cert_principal_t* self, 115 cef_string_list_t names); 116 117 /// 118 // Retrieve the list of domain components. 119 /// 120 void(CEF_CALLBACK* get_domain_components)( 121 struct _cef_x509cert_principal_t* self, 122 cef_string_list_t components); 123 } cef_x509cert_principal_t; 124 125 /// 126 // Structure representing a X.509 certificate. 127 /// 128 typedef struct _cef_x509certificate_t { 129 /// 130 // Base structure. 131 /// 132 cef_base_ref_counted_t base; 133 134 /// 135 // Returns the subject of the X.509 certificate. For HTTPS server certificates 136 // this represents the web server. The common name of the subject should 137 // match the host name of the web server. 138 /// 139 struct _cef_x509cert_principal_t*(CEF_CALLBACK* get_subject)( 140 struct _cef_x509certificate_t* self); 141 142 /// 143 // Returns the issuer of the X.509 certificate. 144 /// 145 struct _cef_x509cert_principal_t*(CEF_CALLBACK* get_issuer)( 146 struct _cef_x509certificate_t* self); 147 148 /// 149 // Returns the DER encoded serial number for the X.509 certificate. The value 150 // possibly includes a leading 00 byte. 151 /// 152 struct _cef_binary_value_t*(CEF_CALLBACK* get_serial_number)( 153 struct _cef_x509certificate_t* self); 154 155 /// 156 // Returns the date before which the X.509 certificate is invalid. 157 // CefTime.GetTimeT() will return 0 if no date was specified. 158 /// 159 cef_time_t(CEF_CALLBACK* get_valid_start)( 160 struct _cef_x509certificate_t* self); 161 162 /// 163 // Returns the date after which the X.509 certificate is invalid. 164 // CefTime.GetTimeT() will return 0 if no date was specified. 165 /// 166 cef_time_t(CEF_CALLBACK* get_valid_expiry)( 167 struct _cef_x509certificate_t* self); 168 169 /// 170 // Returns the DER encoded data for the X.509 certificate. 171 /// 172 struct _cef_binary_value_t*(CEF_CALLBACK* get_derencoded)( 173 struct _cef_x509certificate_t* self); 174 175 /// 176 // Returns the PEM encoded data for the X.509 certificate. 177 /// 178 struct _cef_binary_value_t*(CEF_CALLBACK* get_pemencoded)( 179 struct _cef_x509certificate_t* self); 180 181 /// 182 // Returns the number of certificates in the issuer chain. If 0, the 183 // certificate is self-signed. 184 /// 185 size_t(CEF_CALLBACK* get_issuer_chain_size)( 186 struct _cef_x509certificate_t* self); 187 188 /// 189 // Returns the DER encoded data for the certificate issuer chain. If we failed 190 // to encode a certificate in the chain it is still present in the array but 191 // is an NULL string. 192 /// 193 void(CEF_CALLBACK* get_derencoded_issuer_chain)( 194 struct _cef_x509certificate_t* self, 195 size_t* chainCount, 196 struct _cef_binary_value_t** chain); 197 198 /// 199 // Returns the PEM encoded data for the certificate issuer chain. If we failed 200 // to encode a certificate in the chain it is still present in the array but 201 // is an NULL string. 202 /// 203 void(CEF_CALLBACK* get_pemencoded_issuer_chain)( 204 struct _cef_x509certificate_t* self, 205 size_t* chainCount, 206 struct _cef_binary_value_t** chain); 207 } cef_x509certificate_t; 208 209 #ifdef __cplusplus 210 } 211 #endif 212 213 #endif // CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_ 214