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

Function ExampleTlsCertificates

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected