MCPcopy Create free account
hub / github.com/apple/foundationdb / print

Method print

flow/TLSConfig.actor.cpp:80–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void LoadedTLSConfig::print(FILE* fp) {
81 int num_certs = 0;
82 boost::asio::ssl::context context(boost::asio::ssl::context::tls);
83 try {
84 ConfigureSSLContext(*this, context);
85 } catch (Error& e) {
86 fprintf(fp, "There was an error in loading the certificate chain.\n");
87 throw;
88 }
89
90 X509_STORE* store = SSL_CTX_get_cert_store(context.native_handle());
91 X509_STORE_CTX* store_ctx = X509_STORE_CTX_new();
92 X509* cert = SSL_CTX_get0_certificate(context.native_handle());
93 X509_STORE_CTX_init(store_ctx, store, cert, nullptr);
94
95 X509_verify_cert(store_ctx);
96 STACK_OF(X509)* chain = X509_STORE_CTX_get0_chain(store_ctx);
97
98 X509_print_fp(fp, cert);
99
100 num_certs = sk_X509_num(chain);
101 if (num_certs) {
102 for (int i = 0; i < num_certs; i++) {
103 printf("\n");
104 X509* cert = sk_X509_value(chain, i);
105 X509_print_fp(fp, cert);
106 }
107 }
108
109 X509_STORE_CTX_free(store_ctx);
110}
111
112void ConfigureSSLContext(const LoadedTLSConfig& loaded, boost::asio::ssl::context& context) {
113 try {

Callers 4

smokeTestMethod · 0.45
runMethod · 0.45
printUsageMethod · 0.45

Calls 4

ConfigureSSLContextFunction · 0.85
fprintfFunction · 0.85
printfFunction · 0.85
native_handleMethod · 0.45

Tested by 3

runMethod · 0.36
printUsageMethod · 0.36