| 197 | } |
| 198 | |
| 199 | void getTestCert() |
| 200 | { |
| 201 | std::unordered_map<std::string, std::string> config = Microsoft::Azure::Gaming::GSDK::getConfigSettings(); |
| 202 | auto it = config.find("certificateFolder"); |
| 203 | |
| 204 | if (it != config.end()) |
| 205 | { |
| 206 | std::string testCertificatePath = config["certificateFolder"] + "/LinuxRunnerTestCert.pem"; |
| 207 | |
| 208 | FILE *fp = fopen(testCertificatePath.c_str(), "r"); |
| 209 | if (fp) { |
| 210 | X509 *cert = PEM_read_X509(fp, NULL, NULL, NULL); |
| 211 | if (cert != NULL) { |
| 212 | // get thumbprint |
| 213 | const int sha1Len = 20; |
| 214 | unsigned char sha1Buf[sha1Len]; |
| 215 | const EVP_MD *digest = EVP_sha1(); |
| 216 | unsigned bufLen; |
| 217 | int sha1Res = X509_digest(cert, digest, sha1Buf, &bufLen); |
| 218 | if (sha1Res != 0) |
| 219 | { |
| 220 | testCertificate = hex_encode(sha1Buf, bufLen); |
| 221 | } |
| 222 | |
| 223 | X509_free(cert); |
| 224 | } |
| 225 | fclose(fp); |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | int main() |
| 231 | { |
no test coverage detected