| 211 | } |
| 212 | |
| 213 | std::string hex_encode(unsigned char* data, size_t len) |
| 214 | { |
| 215 | std::stringstream ss; |
| 216 | ss << std::hex << std::setfill('0'); |
| 217 | for (size_t i = 0; i < len; i++) |
| 218 | { |
| 219 | // Cast data[i] to an int so that it uses the int-based overload of the << operator. |
| 220 | // If it uses the char-based overload then it's going to treat data[i] as a printable character. |
| 221 | // See: [https://arstechnica.com/civis/viewtopic.php?t=796634](https://arstechnica.com/civis/viewtopic.php?t=796634) |
| 222 | ss << std::setw(2) << static_cast<unsigned int>(data[i]); |
| 223 | } |
| 224 | return ss.str(); |
| 225 | } |
| 226 | |
| 227 | bool DoesCertificateExist(std::string expectedThumbprint) |
| 228 | { |
no outgoing calls
no test coverage detected