MCPcopy Create free account
hub / github.com/3rdparty/libprocess / write_certificate_file

Function write_certificate_file

src/ssl/utilities.cpp:333–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331
332
333Try<Nothing> write_certificate_file(X509* x509, const Path& path)
334{
335 // We use 'FILE*' here because it is an API requirement by openssl.
336 FILE* file = fopen(path.string().c_str(), "wb");
337 if (file == nullptr) {
338 return Error("Failed to open file '" + stringify(path) + "' for writing");
339 }
340
341 if (PEM_write_X509(file, x509) != 1) {
342 fclose(file);
343 return Error("Failed to write certificate to file '" + stringify(path) +
344 "': PEM_write_X509");
345 }
346
347 fclose(file);
348
349 return Nothing();
350}
351
352
353Try<string> generate_hmac_sha256(

Callers 1

Calls 1

stringMethod · 0.80

Tested by 1