MCPcopy Create free account
hub / github.com/apache/arrow / ExampleTlsCertificates

Function ExampleTlsCertificates

cpp/src/arrow/flight/test_util.cc:267–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267Status ExampleTlsCertificates(std::vector<CertKeyPair>* out) {
268 ARROW_ASSIGN_OR_RAISE(auto root, GetTestResourceRoot());
269
270 *out = std::vector<CertKeyPair>();
271 for (int i = 0; i < 2; i++) {
272 try {
273 std::stringstream cert_path;
274 cert_path << root << "/flight/cert" << i << ".pem";
275 std::stringstream key_path;
276 key_path << root << "/flight/cert" << i << ".key";
277
278 std::ifstream cert_file(cert_path.str());
279 if (!cert_file) {
280 return Status::IOError("Could not open certificate: " + cert_path.str());
281 }
282 std::stringstream cert;
283 cert << cert_file.rdbuf();
284
285 std::ifstream key_file(key_path.str());
286 if (!key_file) {
287 return Status::IOError("Could not open key: " + key_path.str());
288 }
289 std::stringstream key;
290 key << key_file.rdbuf();
291
292 out->push_back(CertKeyPair{cert.str(), key.str()});
293 } catch (const std::ifstream::failure& e) {
294 return Status::IOError(e.what());
295 }
296 }
297 return Status::OK();
298}
299
300Status ExampleTlsCertificateRoot(CertKeyPair* out) {
301 ARROW_ASSIGN_OR_RAISE(auto path, GetTestResourcePath("flight/root-ca.pem"));

Callers

nothing calls this directly

Calls 5

IOErrorFunction · 0.85
strMethod · 0.80
push_backMethod · 0.80
OKFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected