• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=b5ab278c54b7ed9046b43a7f362a18ebc8bde146$
13 //
14 
15 #include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
16 #include <algorithm>
17 #include "libcef_dll/ctocpp/binary_value_ctocpp.h"
18 #include "libcef_dll/ctocpp/x509cert_principal_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20 
21 // VIRTUAL METHODS - Body may be edited by hand.
22 
23 NO_SANITIZE("cfi-icall")
GetSubject()24 CefRefPtr<CefX509CertPrincipal> CefX509CertificateCToCpp::GetSubject() {
25   shutdown_checker::AssertNotShutdown();
26 
27   cef_x509certificate_t* _struct = GetStruct();
28   if (CEF_MEMBER_MISSING(_struct, get_subject))
29     return nullptr;
30 
31   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32 
33   // Execute
34   cef_x509cert_principal_t* _retval = _struct->get_subject(_struct);
35 
36   // Return type: refptr_same
37   return CefX509CertPrincipalCToCpp::Wrap(_retval);
38 }
39 
40 NO_SANITIZE("cfi-icall")
GetIssuer()41 CefRefPtr<CefX509CertPrincipal> CefX509CertificateCToCpp::GetIssuer() {
42   shutdown_checker::AssertNotShutdown();
43 
44   cef_x509certificate_t* _struct = GetStruct();
45   if (CEF_MEMBER_MISSING(_struct, get_issuer))
46     return nullptr;
47 
48   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
49 
50   // Execute
51   cef_x509cert_principal_t* _retval = _struct->get_issuer(_struct);
52 
53   // Return type: refptr_same
54   return CefX509CertPrincipalCToCpp::Wrap(_retval);
55 }
56 
57 NO_SANITIZE("cfi-icall")
GetSerialNumber()58 CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetSerialNumber() {
59   shutdown_checker::AssertNotShutdown();
60 
61   cef_x509certificate_t* _struct = GetStruct();
62   if (CEF_MEMBER_MISSING(_struct, get_serial_number))
63     return nullptr;
64 
65   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
66 
67   // Execute
68   cef_binary_value_t* _retval = _struct->get_serial_number(_struct);
69 
70   // Return type: refptr_same
71   return CefBinaryValueCToCpp::Wrap(_retval);
72 }
73 
GetValidStart()74 NO_SANITIZE("cfi-icall") CefTime CefX509CertificateCToCpp::GetValidStart() {
75   shutdown_checker::AssertNotShutdown();
76 
77   cef_x509certificate_t* _struct = GetStruct();
78   if (CEF_MEMBER_MISSING(_struct, get_valid_start))
79     return CefTime();
80 
81   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82 
83   // Execute
84   cef_time_t _retval = _struct->get_valid_start(_struct);
85 
86   // Return type: simple
87   return _retval;
88 }
89 
GetValidExpiry()90 NO_SANITIZE("cfi-icall") CefTime CefX509CertificateCToCpp::GetValidExpiry() {
91   shutdown_checker::AssertNotShutdown();
92 
93   cef_x509certificate_t* _struct = GetStruct();
94   if (CEF_MEMBER_MISSING(_struct, get_valid_expiry))
95     return CefTime();
96 
97   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
98 
99   // Execute
100   cef_time_t _retval = _struct->get_valid_expiry(_struct);
101 
102   // Return type: simple
103   return _retval;
104 }
105 
106 NO_SANITIZE("cfi-icall")
GetDEREncoded()107 CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetDEREncoded() {
108   shutdown_checker::AssertNotShutdown();
109 
110   cef_x509certificate_t* _struct = GetStruct();
111   if (CEF_MEMBER_MISSING(_struct, get_derencoded))
112     return nullptr;
113 
114   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115 
116   // Execute
117   cef_binary_value_t* _retval = _struct->get_derencoded(_struct);
118 
119   // Return type: refptr_same
120   return CefBinaryValueCToCpp::Wrap(_retval);
121 }
122 
123 NO_SANITIZE("cfi-icall")
GetPEMEncoded()124 CefRefPtr<CefBinaryValue> CefX509CertificateCToCpp::GetPEMEncoded() {
125   shutdown_checker::AssertNotShutdown();
126 
127   cef_x509certificate_t* _struct = GetStruct();
128   if (CEF_MEMBER_MISSING(_struct, get_pemencoded))
129     return nullptr;
130 
131   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
132 
133   // Execute
134   cef_binary_value_t* _retval = _struct->get_pemencoded(_struct);
135 
136   // Return type: refptr_same
137   return CefBinaryValueCToCpp::Wrap(_retval);
138 }
139 
GetIssuerChainSize()140 NO_SANITIZE("cfi-icall") size_t CefX509CertificateCToCpp::GetIssuerChainSize() {
141   shutdown_checker::AssertNotShutdown();
142 
143   cef_x509certificate_t* _struct = GetStruct();
144   if (CEF_MEMBER_MISSING(_struct, get_issuer_chain_size))
145     return 0;
146 
147   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148 
149   // Execute
150   size_t _retval = _struct->get_issuer_chain_size(_struct);
151 
152   // Return type: simple
153   return _retval;
154 }
155 
156 NO_SANITIZE("cfi-icall")
GetDEREncodedIssuerChain(IssuerChainBinaryList & chain)157 void CefX509CertificateCToCpp::GetDEREncodedIssuerChain(
158     IssuerChainBinaryList& chain) {
159   shutdown_checker::AssertNotShutdown();
160 
161   cef_x509certificate_t* _struct = GetStruct();
162   if (CEF_MEMBER_MISSING(_struct, get_derencoded_issuer_chain))
163     return;
164 
165   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
166 
167   // Translate param: chain; type: refptr_vec_same_byref
168   size_t chainSize = chain.size();
169   size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
170   cef_binary_value_t** chainList = NULL;
171   if (chainCount > 0) {
172     chainList = new cef_binary_value_t*[chainCount];
173     DCHECK(chainList);
174     if (chainList) {
175       memset(chainList, 0, sizeof(cef_binary_value_t*) * chainCount);
176     }
177     if (chainList && chainSize > 0) {
178       for (size_t i = 0; i < chainSize; ++i) {
179         chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
180       }
181     }
182   }
183 
184   // Execute
185   _struct->get_derencoded_issuer_chain(_struct, &chainCount, chainList);
186 
187   // Restore param:chain; type: refptr_vec_same_byref
188   chain.clear();
189   if (chainCount > 0 && chainList) {
190     for (size_t i = 0; i < chainCount; ++i) {
191       chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
192     }
193     delete[] chainList;
194   }
195 }
196 
197 NO_SANITIZE("cfi-icall")
GetPEMEncodedIssuerChain(IssuerChainBinaryList & chain)198 void CefX509CertificateCToCpp::GetPEMEncodedIssuerChain(
199     IssuerChainBinaryList& chain) {
200   shutdown_checker::AssertNotShutdown();
201 
202   cef_x509certificate_t* _struct = GetStruct();
203   if (CEF_MEMBER_MISSING(_struct, get_pemencoded_issuer_chain))
204     return;
205 
206   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
207 
208   // Translate param: chain; type: refptr_vec_same_byref
209   size_t chainSize = chain.size();
210   size_t chainCount = std::max(GetIssuerChainSize(), chainSize);
211   cef_binary_value_t** chainList = NULL;
212   if (chainCount > 0) {
213     chainList = new cef_binary_value_t*[chainCount];
214     DCHECK(chainList);
215     if (chainList) {
216       memset(chainList, 0, sizeof(cef_binary_value_t*) * chainCount);
217     }
218     if (chainList && chainSize > 0) {
219       for (size_t i = 0; i < chainSize; ++i) {
220         chainList[i] = CefBinaryValueCToCpp::Unwrap(chain[i]);
221       }
222     }
223   }
224 
225   // Execute
226   _struct->get_pemencoded_issuer_chain(_struct, &chainCount, chainList);
227 
228   // Restore param:chain; type: refptr_vec_same_byref
229   chain.clear();
230   if (chainCount > 0 && chainList) {
231     for (size_t i = 0; i < chainCount; ++i) {
232       chain.push_back(CefBinaryValueCToCpp::Wrap(chainList[i]));
233     }
234     delete[] chainList;
235   }
236 }
237 
238 // CONSTRUCTOR - Do not edit by hand.
239 
CefX509CertificateCToCpp()240 CefX509CertificateCToCpp::CefX509CertificateCToCpp() {}
241 
242 // DESTRUCTOR - Do not edit by hand.
243 
~CefX509CertificateCToCpp()244 CefX509CertificateCToCpp::~CefX509CertificateCToCpp() {
245   shutdown_checker::AssertNotShutdown();
246 }
247 
248 template <>
249 cef_x509certificate_t* CefCToCppRefCounted<
250     CefX509CertificateCToCpp,
251     CefX509Certificate,
UnwrapDerived(CefWrapperType type,CefX509Certificate * c)252     cef_x509certificate_t>::UnwrapDerived(CefWrapperType type,
253                                           CefX509Certificate* c) {
254   NOTREACHED() << "Unexpected class type: " << type;
255   return nullptr;
256 }
257 
258 template <>
259 CefWrapperType CefCToCppRefCounted<CefX509CertificateCToCpp,
260                                    CefX509Certificate,
261                                    cef_x509certificate_t>::kWrapperType =
262     WT_X509CERTIFICATE;
263