MCPcopy Create free account
hub / github.com/PlayFab/gsdk / getTestCert

Function getTestCert

cpp/testapps/cppLinuxRunnerGame/main.cpp:199–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void 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
230int main()
231{

Callers 1

mainFunction · 0.70

Calls 3

findMethod · 0.80
endMethod · 0.80
hex_encodeFunction · 0.70

Tested by

no test coverage detected