MCPcopy Create free account
hub / github.com/apache/qpid-proton / parse_tls

Function parse_tls

cpp/src/connect_config.cpp:123–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void parse_tls(const string& scheme, Value root, connection_options& opts) {
124 Value tls = get(objectValue, root, "tls");
125 if (scheme == "amqps") { // TLS is enabled
126 ssl::verify_mode mode = ssl::VERIFY_PEER_NAME;
127 Value verifyValue = get(booleanValue, tls, "verify");
128 if (!verifyValue.empty()) {
129 mode = verifyValue.asBool() ? ssl::VERIFY_PEER_NAME : ssl::ANONYMOUS_PEER;
130 }
131 string ca = get_string(tls, "ca", "");
132 string cert = get_string(tls, "cert", "");
133 string key = get_string(tls, "key", "");
134 if (!cert.empty()) {
135 ssl_certificate sc = key.empty() ? ssl_certificate(cert) : ssl_certificate(cert, key);
136 opts.ssl_client_options(ssl_client_options(sc, ca, mode));
137 } else if (!ca.empty()) {
138 opts.ssl_client_options(ssl_client_options(ca, mode));
139 } else if (!verifyValue.empty()) {
140 opts.ssl_client_options(ssl_client_options(mode));
141 } else {
142 opts.ssl_client_options(ssl_client_options());
143 }
144 } else if (!tls.empty()) {
145 throw err(msg() << "'tls' object not allowed unless scheme is \"amqps\"");
146 }
147}
148
149} // namespace
150

Callers 1

parseFunction · 0.85

Calls 8

get_stringFunction · 0.85
ssl_certificateClass · 0.85
errFunction · 0.85
msgClass · 0.85
ssl_client_optionsMethod · 0.80
getFunction · 0.70
ssl_client_optionsClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected