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

Function find_CN

cpp/examples/ssl_client_cert.cpp:193–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193std::string find_CN(const std::string &subject) {
194 // The subject string is returned with different whitespace and component ordering between platforms.
195 // Here we just return the common name by searching for "CN=...." in the subject, knowing that
196 // the test certificates do not contain any escaped characters.
197 size_t pos = subject.find("CN=");
198 if (pos == std::string::npos) throw std::runtime_error("No common name in certificate subject");
199 std::string cn = subject.substr(pos);
200 pos = cn.find(',');
201 return pos == std::string::npos ? cn : cn.substr(0, pos);
202}

Callers 2

on_connection_openMethod · 0.70
on_connection_openMethod · 0.70

Calls 2

findMethod · 0.80
substrMethod · 0.80

Tested by

no test coverage detected