MCPcopy Create free account
hub / github.com/apache/trafficserver / getSecret

Method getSecret

src/iocore/net/SSLSecret.cc:122–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122std::string
123SSLSecret::getSecret(const std::string &name) const
124{
125 std::scoped_lock lock(secret_map_mutex);
126 auto iter = secret_map.find(name);
127 if (secret_map.end() == iter) {
128 Dbg(dbg_ctl_ssl_secret, "Get secret for %s: not found", name.c_str());
129 return std::string{};
130 }
131 if (iter->second.empty()) {
132 Dbg(dbg_ctl_ssl_secret, "Get secret for %s: empty", name.c_str());
133 return std::string{};
134 }
135 // The full secret data can be sensitive. Print only the first 50 bytes.
136 if (dbg_ctl_ssl_secret.on()) {
137 char hash_str[EVP_MAX_MD_SIZE * 2];
138 unsigned int hash_len;
139 get_hash_str(iter->second, hash_str, &hash_len);
140 DbgPrint(dbg_ctl_ssl_secret, "Get secret for %s: hash=%.*s %.50s", name.c_str(), hash_len, hash_str, iter->second.c_str());
141 }
142 return iter->second;
143}
144
145void
146SSLSecret::getOrLoadSecret(const std::string &name1, const std::string &name2, std::string &data1, std::string &data2)

Callers 2

loadSecretMethod · 0.95
TSSslSecretGetFunction · 0.80

Calls 6

get_hash_strFunction · 0.85
findMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected