Lines Matching full:std

40 namespace fs = std::filesystem;
46 bool compareFiles(const std::string& file1, const std::string& file2) in compareFiles()
48 std::ifstream f1(file1, std::ifstream::binary | std::ifstream::ate); in compareFiles()
49 std::ifstream f2(file2, std::ifstream::binary | std::ifstream::ate); in compareFiles()
61 // seek back to beginning and use std::equal to compare contents in compareFiles()
62 f1.seekg(0, std::ifstream::beg); in compareFiles()
63 f2.seekg(0, std::ifstream::beg); in compareFiles()
64 return std::equal(std::istreambuf_iterator<char>(f1.rdbuf()), in compareFiles()
65 std::istreambuf_iterator<char>(), in compareFiles()
66 std::istreambuf_iterator<char>(f2.rdbuf())); in compareFiles()
82 throw std::bad_alloc(); in SetUp()
84 certDir = std::string(dirPtr) + "/certs"; in SetUp()
105 std::string cmd = "openssl req -x509 -sha256 -newkey rsa:2048 "; in createNewCertificate()
111 cmd += std::to_string(certId++); in createNewCertificate()
114 auto val = std::system(cmd.c_str()); in createNewCertificate()
117 std::cout << "COMMAND Error: " << val << std::endl; in createNewCertificate()
130 ASSERT_EQ(std::system("mkdir -p demoCA"), 0); in createNeverExpiredRootCertificate()
131 ASSERT_EQ(std::system("mkdir -p demoCA/private/"), 0); in createNeverExpiredRootCertificate()
132 ASSERT_EQ(std::system("mkdir -p demoCA/newcerts/"), 0); in createNeverExpiredRootCertificate()
133 ASSERT_EQ(std::system("touch demoCA/index.txt"), 0); in createNeverExpiredRootCertificate()
134 ASSERT_EQ(std::system("echo 1000 > demoCA/serial"), 0); in createNeverExpiredRootCertificate()
136 std::system( in createNeverExpiredRootCertificate()
141 ASSERT_EQ(std::system( in createNeverExpiredRootCertificate()
147 std::system( in createNeverExpiredRootCertificate()
153 bool compareFiles(const std::string& file1, const std::string& file2) in compareFiles()
155 std::ifstream f1(file1, std::ifstream::binary | std::ifstream::ate); in compareFiles()
156 std::ifstream f2(file2, std::ifstream::binary | std::ifstream::ate); in compareFiles()
168 // seek back to beginning and use std::equal to compare contents in compareFiles()
169 f1.seekg(0, std::ifstream::beg); in compareFiles()
170 f2.seekg(0, std::ifstream::beg); in compareFiles()
171 return std::equal(std::istreambuf_iterator<char>(f1.rdbuf()), in compareFiles()
172 std::istreambuf_iterator<char>(), in compareFiles()
173 std::istreambuf_iterator<char>(f2.rdbuf())); in compareFiles()
176 std::string getCertSubjectNameHash(const std::string& certFilePath) in getCertSubjectNameHash()
178 std::unique_ptr<X509, decltype(&::X509_free)> cert(X509_new(), in getCertSubjectNameHash()
182 std::string(); in getCertSubjectNameHash()
185 std::unique_ptr<BIO, decltype(&::BIO_free)> bioCert( in getCertSubjectNameHash()
189 std::string(); in getCertSubjectNameHash()
195 std::string(); in getCertSubjectNameHash()
202 return std::string(hashBuf); in getCertSubjectNameHash()
207 std::string certificateFile, CSRFile, privateKeyFile, rsaPrivateKeyFilePath;
209 std::string certDir;
219 void install(std::string& path) in install()
224 std::string generateCSR( in generateCSR()
225 std::vector<std::string> alternativeNames, in generateCSR()
226 std::string challengePassword, std::string city, std::string commonName, in generateCSR()
227 std::string contactPerson, std::string country, std::string email, in generateCSR()
228 std::string givenName, std::string initials, int64_t keyBitLength, in generateCSR()
229 std::string keyCurveId, std::string keyPairAlgorithm, in generateCSR()
230 std::vector<std::string> keyUsage, std::string organization, in generateCSR()
231 std::string organizationalUnit, std::string state, std::string surname, in generateCSR()
232 std::string unstructuredName) in generateCSR()
240 std::string csr() in csr()
251 static constexpr std::string_view unitToRestartInTest =
255 const std::string& unit, const std::string& installPath) : in ManagerInTest()
259 MOCK_METHOD(void, reloadOrReset, (const std::string&), (override));
266 std::string endpoint("https"); in TEST_F()
268 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
269 std::string verifyPath(installPath); in TEST_F()
270 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
271 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
289 std::string endpoint("ldap"); in TEST_F()
291 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
292 std::string verifyPath(installPath); in TEST_F()
293 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
294 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
312 std::string endpoint("truststore"); in TEST_F()
314 std::string verifyDir(certDir); in TEST_F()
315 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
316 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
330 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
340 std::string verifyPath = in TEST_F()
355 std::string endpoint("truststore"); in TEST_F()
357 std::string verifyDir(certDir); in TEST_F()
358 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
359 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
374 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
380 std::string verifyPath = in TEST_F()
396 std::string endpoint("truststore"); in TEST_F()
398 std::string verifyDir(certDir); in TEST_F()
399 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
400 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
406 std::move(certDir)); in TEST_F()
412 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
418 std::string verifyPath = in TEST_F()
452 std::string endpoint("truststore"); in TEST_F()
454 std::string verifyDir(certDir); in TEST_F()
455 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
456 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
469 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
475 std::string verifyPath0 = in TEST_F()
493 std::string verifyPath1 = in TEST_F()
510 std::string endpoint("truststore"); in TEST_F()
512 std::string verifyDir(certDir); in TEST_F()
513 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
514 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
525 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
528 std::vector<std::string> verifyPaths; in TEST_F()
531 for (std::size_t i = 0; i < maxNumAuthorityCertificates; ++i) in TEST_F()
543 std::string verifyPath = in TEST_F()
586 std::string endpoint("ldap"); in TEST_F()
588 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
589 std::string verifyPath(installPath); in TEST_F()
590 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
591 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
610 std::string endpoint("ldap"); in TEST_F()
612 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
613 std::string verifyPath(installPath); in TEST_F()
614 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
615 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
617 std::string uploadFile = "nofile.pem"; in TEST_F()
643 std::string endpoint("ldap"); in TEST_F()
645 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
646 std::string verifyPath(installPath); in TEST_F()
647 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
648 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
654 std::move(installPath)); in TEST_F()
661 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
673 std::string endpoint("truststore"); in TEST_F()
675 std::string verifyDir(certDir); in TEST_F()
676 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
677 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
691 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
699 std::string verifyPath = in TEST_F()
723 std::string endpoint("truststore"); in TEST_F()
725 std::string verifyDir(certDir); in TEST_F()
726 std::string verifyUnit((ManagerInTest::unitToRestartInTest)); in TEST_F()
727 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
749 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
776 std::string endpoint("ldap"); in TEST_F()
778 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
779 std::string verifyPath(installPath); in TEST_F()
780 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
781 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
783 std::string emptyFile("emptycert.pem"); in TEST_F()
784 std::ofstream ofs; in TEST_F()
785 ofs.open(emptyFile, std::ofstream::out); in TEST_F()
813 std::string endpoint("ldap"); in TEST_F()
816 std::ofstream ofs; in TEST_F()
817 ofs.open(certificateFile, std::ofstream::out); in TEST_F()
823 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
824 std::string verifyPath(installPath); in TEST_F()
825 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
826 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
862 throw std::bad_alloc(); in SetUp()
864 certDir = std::string(dirPtr) + "/certs"; in SetUp()
868 std::string cmd = "openssl req -x509 -sha256 -newkey rsa:2048 "; in SetUp()
874 auto val = std::system(cmd.c_str()); in SetUp()
877 std::cout << "command Error: " << val << std::endl; in SetUp()
889 std::string certificateFile;
890 std::string keyFile;
891 std::string certDir;
898 std::string endpoint("ldap"); in TEST_F()
900 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
901 std::string verifyPath(installPath); in TEST_F()
902 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
903 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
930 std::string endpoint("ldap"); in TEST_F()
932 std::string installPath(certDir + "/" + keyFile); in TEST_F()
933 std::string verifyPath(installPath); in TEST_F()
934 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
935 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
965 std::string endpoint("ldap"); in TEST_F()
967 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
968 std::string verifyPath(installPath); in TEST_F()
969 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
970 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
997 std::string endpoint("https"); in TEST_F()
998 std::string unit; in TEST_F()
1000 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1001 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1002 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1003 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1004 std::string challengePassword("Password"); in TEST_F()
1005 std::string city("HYB"); in TEST_F()
1006 std::string commonName("abc.com"); in TEST_F()
1007 std::string contactPerson("Admin"); in TEST_F()
1008 std::string country("IN"); in TEST_F()
1009 std::string email("admin@in.ibm.com"); in TEST_F()
1010 std::string givenName("givenName"); in TEST_F()
1011 std::string initials("G"); in TEST_F()
1013 std::string keyCurveId("0"); in TEST_F()
1014 std::string keyPairAlgorithm("RSA"); in TEST_F()
1015 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1016 std::string organization("IBM"); in TEST_F()
1017 std::string organizationalUnit("orgUnit"); in TEST_F()
1018 std::string state("TS"); in TEST_F()
1019 std::string surname("surname"); in TEST_F()
1020 std::string unstructuredName("unstructuredName"); in TEST_F()
1021 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1026 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1027 std::move(installPath)); in TEST_F()
1036 std::string csrData{}; in TEST_F()
1065 std::string endpoint("https"); in TEST_F()
1066 std::string unit; in TEST_F()
1068 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1069 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1070 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1071 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1072 std::string challengePassword("Password"); in TEST_F()
1073 std::string city("HYB"); in TEST_F()
1074 std::string commonName("abc.com"); in TEST_F()
1075 std::string contactPerson("Admin"); in TEST_F()
1076 std::string country("IN"); in TEST_F()
1077 std::string email("admin@in.ibm.com"); in TEST_F()
1078 std::string givenName("givenName"); in TEST_F()
1079 std::string initials("G"); in TEST_F()
1081 std::string keyCurveId(""); in TEST_F()
1082 std::string keyPairAlgorithm(""); in TEST_F()
1083 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1084 std::string organization("IBM"); in TEST_F()
1085 std::string organizationalUnit("orgUnit"); in TEST_F()
1086 std::string state("TS"); in TEST_F()
1087 std::string surname("surname"); in TEST_F()
1088 std::string unstructuredName("unstructuredName"); in TEST_F()
1089 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1092 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1093 std::move(installPath)); in TEST_F()
1112 std::string endpoint("https"); in TEST_F()
1113 std::string unit; in TEST_F()
1115 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1116 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1117 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1118 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1119 std::string challengePassword("Password"); in TEST_F()
1120 std::string city("HYB"); in TEST_F()
1121 std::string commonName("abc.com"); in TEST_F()
1122 std::string contactPerson("Admin"); in TEST_F()
1123 std::string country("IN"); in TEST_F()
1124 std::string email("admin@in.ibm.com"); in TEST_F()
1125 std::string givenName("givenName"); in TEST_F()
1126 std::string initials("G"); in TEST_F()
1128 std::string keyCurveId("secp521r1"); in TEST_F()
1129 std::string keyPairAlgorithm("UnSupportedAlgorithm"); in TEST_F()
1130 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1131 std::string organization("IBM"); in TEST_F()
1132 std::string organizationalUnit("orgUnit"); in TEST_F()
1133 std::string state("TS"); in TEST_F()
1134 std::string surname("surname"); in TEST_F()
1135 std::string unstructuredName("unstructuredName"); in TEST_F()
1136 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1139 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1140 std::move(installPath)); in TEST_F()
1158 std::string endpoint("https"); in TEST_F()
1159 std::string unit; in TEST_F()
1161 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1162 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1163 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1164 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1165 std::string challengePassword("Password"); in TEST_F()
1166 std::string city("BLR"); in TEST_F()
1167 std::string commonName("abc.com"); in TEST_F()
1168 std::string contactPerson("Admin"); in TEST_F()
1169 std::string country("IN"); in TEST_F()
1170 std::string email("admin@in.ibm.com"); in TEST_F()
1171 std::string givenName("givenName"); in TEST_F()
1172 std::string initials("G"); in TEST_F()
1174 std::string keyCurveId("DummyCurveName"); in TEST_F()
1175 std::string keyPairAlgorithm("EC"); in TEST_F()
1176 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1177 std::string organization("IBM"); in TEST_F()
1178 std::string organizationalUnit("orgUnit"); in TEST_F()
1179 std::string state("TS"); in TEST_F()
1180 std::string surname("surname"); in TEST_F()
1181 std::string unstructuredName("unstructuredName"); in TEST_F()
1182 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1185 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1186 std::move(installPath)); in TEST_F()
1203 std::string endpoint("https"); in TEST_F()
1204 std::string unit; in TEST_F()
1206 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1207 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1208 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1209 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1210 std::string challengePassword("Password"); in TEST_F()
1211 std::string city("BLR"); in TEST_F()
1212 std::string commonName("abc.com"); in TEST_F()
1213 std::string contactPerson("Admin"); in TEST_F()
1214 std::string country("IN"); in TEST_F()
1215 std::string email("admin@in.ibm.com"); in TEST_F()
1216 std::string givenName("givenName"); in TEST_F()
1217 std::string initials("G"); in TEST_F()
1219 std::string keyCurveId(""); in TEST_F()
1220 std::string keyPairAlgorithm("EC"); in TEST_F()
1221 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1222 std::string organization("IBM"); in TEST_F()
1223 std::string organizationalUnit("orgUnit"); in TEST_F()
1224 std::string state("TS"); in TEST_F()
1225 std::string surname("surname"); in TEST_F()
1226 std::string unstructuredName("unstructuredName"); in TEST_F()
1227 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1230 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1231 std::move(installPath)); in TEST_F()
1249 std::string endpoint("https"); in TEST_F()
1250 std::string unit; in TEST_F()
1252 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1253 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1254 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1255 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1256 std::string challengePassword("Password"); in TEST_F()
1257 std::string city("BLR"); in TEST_F()
1258 std::string commonName("abc.com"); in TEST_F()
1259 std::string contactPerson("Admin"); in TEST_F()
1260 std::string country("IN"); in TEST_F()
1261 std::string email("admin@in.ibm.com"); in TEST_F()
1262 std::string givenName("givenName"); in TEST_F()
1263 std::string initials("G"); in TEST_F()
1265 std::string keyCurveId("secp521r1"); in TEST_F()
1266 std::string keyPairAlgorithm("EC"); in TEST_F()
1267 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1268 std::string organization("IBM"); in TEST_F()
1269 std::string organizationalUnit("orgUnit"); in TEST_F()
1270 std::string state("TS"); in TEST_F()
1271 std::string surname("surname"); in TEST_F()
1272 std::string unstructuredName("unstructuredName"); in TEST_F()
1273 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1276 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1277 std::move(installPath)); in TEST_F()
1286 std::cout << "CSRPath: " << csrPath << std::endl in TEST_F()
1287 << "privateKeyPath: " << privateKeyPath << std::endl; in TEST_F()
1298 std::string endpoint("https"); in TEST_F()
1299 std::string unit; in TEST_F()
1301 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1302 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1303 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1304 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1305 std::string challengePassword("Password"); in TEST_F()
1306 std::string city("BLR"); in TEST_F()
1307 std::string commonName("abc.com"); in TEST_F()
1308 std::string contactPerson("Admin"); in TEST_F()
1309 std::string country("IN"); in TEST_F()
1310 std::string email("admin@in.ibm.com"); in TEST_F()
1311 std::string givenName("givenName"); in TEST_F()
1312 std::string initials("G"); in TEST_F()
1314 std::string keyCurveId("secp521r1"); in TEST_F()
1315 std::string keyPairAlgorithm("RSA"); in TEST_F()
1316 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1317 std::string organization("IBM"); in TEST_F()
1318 std::string organizationalUnit("orgUnit"); in TEST_F()
1319 std::string state("TS"); in TEST_F()
1320 std::string surname("surname"); in TEST_F()
1321 std::string unstructuredName("unstructuredName"); in TEST_F()
1322 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1325 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1326 std::move(installPath)); in TEST_F()
1343 std::string endpoint("https"); in TEST_F()
1344 std::string unit; in TEST_F()
1346 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1347 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1348 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1349 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1350 std::string challengePassword("Password"); in TEST_F()
1351 std::string city("BLR"); in TEST_F()
1352 std::string commonName("abc.com"); in TEST_F()
1353 std::string contactPerson("Admin"); in TEST_F()
1354 std::string country("IN"); in TEST_F()
1355 std::string email("admin@in.ibm.com"); in TEST_F()
1356 std::string givenName("givenName"); in TEST_F()
1357 std::string initials("G"); in TEST_F()
1359 std::string keyCurveId("secp521r1"); in TEST_F()
1360 std::string keyPairAlgorithm("RSA"); in TEST_F()
1361 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1362 std::string organization("IBM"); in TEST_F()
1363 std::string organizationalUnit("orgUnit"); in TEST_F()
1364 std::string state("TS"); in TEST_F()
1365 std::string surname("surname"); in TEST_F()
1366 std::string unstructuredName("unstructuredName"); in TEST_F()
1367 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1370 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1371 std::move(installPath)); in TEST_F()
1393 std::string endpoint("https"); in TEST_F()
1394 std::string unit; in TEST_F()
1396 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1397 std::string csrPath(certDir + "/" + CSRFile); in TEST_F()
1398 std::string privateKeyPath(certDir + "/" + privateKeyFile); in TEST_F()
1399 std::vector<std::string> alternativeNames{"localhost1", "localhost2"}; in TEST_F()
1400 std::string challengePassword("Password"); in TEST_F()
1401 std::string city("BLR"); in TEST_F()
1402 std::string commonName("abc.com"); in TEST_F()
1403 std::string contactPerson("Admin"); in TEST_F()
1404 std::string country("IN"); in TEST_F()
1405 std::string email("admin@in.ibm.com"); in TEST_F()
1406 std::string givenName("givenName"); in TEST_F()
1407 std::string initials("G"); in TEST_F()
1409 std::string keyCurveId("secp521r1"); in TEST_F()
1410 std::string keyPairAlgorithm("RSA"); in TEST_F()
1411 std::vector<std::string> keyUsage{"serverAuth", "clientAuth"}; in TEST_F()
1412 std::string organization("IBM"); in TEST_F()
1413 std::string organizationalUnit("orgUnit"); in TEST_F()
1414 std::string state("TS"); in TEST_F()
1415 std::string surname("surname"); in TEST_F()
1416 std::string unstructuredName("unstructuredName"); in TEST_F()
1417 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1420 Manager manager(bus, event, objPath.c_str(), type, std::move(unit), in TEST_F()
1421 std::move(installPath)); in TEST_F()
1438 std::string endpoint("https"); in TEST_F()
1440 std::string installPath(certDir + "/" + certificateFile); in TEST_F()
1441 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1442 auto objPath = std::string(objectNamePrefix) + '/' + in TEST_F()
1482 std::string name = "root_" + std::to_string(i); in createAuthoritiesList()
1492 static void createSingleAuthority(const std::string& path, in createSingleAuthority()
1493 const std::string& cn) in createSingleAuthority()
1495 std::string key = fs::path(path) / (cn + "_key"); in createSingleAuthority()
1496 std::string cert = fs::path(path) / (cn + "_cert"); in createSingleAuthority()
1497 std::string cmd = "openssl req -x509 -sha256 -newkey rsa:2048 -keyout "; in createSingleAuthority()
1500 ASSERT_EQ(std::system(cmd.c_str()), 0); in createSingleAuthority()
1504 static void appendContentFromFile(const std::string& to, in appendContentFromFile()
1505 const std::string& from) in appendContentFromFile()
1508 std::ifstream inputCertFileStream; in appendContentFromFile()
1509 std::ofstream outputCertFileStream; in appendContentFromFile()
1511 std::ifstream::failbit | std::ifstream::badbit | in appendContentFromFile()
1512 std::ifstream::eofbit); in appendContentFromFile()
1514 std::ofstream::failbit | std::ofstream::badbit | in appendContentFromFile()
1515 std::ofstream::eofbit); in appendContentFromFile()
1517 outputCertFileStream.open(to, std::ios::app); in appendContentFromFile()
1518 outputCertFileStream << inputCertFileStream.rdbuf() << std::flush; in appendContentFromFile()
1525 static void setContentFromString(const std::string& to, in setContentFromString()
1526 const std::string& from) in setContentFromString()
1529 std::ofstream outputCertFileStream; in setContentFromString()
1531 std::ofstream::failbit | std::ofstream::badbit | in setContentFromString()
1532 std::ofstream::eofbit); in setContentFromString()
1533 outputCertFileStream.open(to, std::ios::out); in setContentFromString()
1534 outputCertFileStream << from << std::flush; in setContentFromString()
1540 void verifyCertificates(std::vector<std::unique_ptr<Certificate>>& certs) in verifyCertificates()
1552 std::string name = "root_" + std::to_string(i); in verifyCertificates()
1555 std::string symbolLink = in verifyCertificates()
1564 static void compareFileAgainstString(const std::string& path, in compareFileAgainstString()
1565 const std::string& buffer) in compareFileAgainstString()
1568 std::ifstream inputCertFileStream; in compareFileAgainstString()
1570 std::ifstream::failbit | std::ifstream::badbit | in compareFileAgainstString()
1571 std::ifstream::eofbit); in compareFileAgainstString()
1573 std::stringstream read; in compareFileAgainstString()
1589 std::string endpoint("truststore"); in TEST_F()
1590 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1593 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1604 std::vector<sdbusplus::message::object_path> objects = in TEST_F()
1617 std::string endpoint("truststore"); in TEST_F()
1618 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1621 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1641 std::unordered_set<std::string> expectedFiles = { in TEST_F()
1643 std::vector<std::unique_ptr<Certificate>>& certs = in TEST_F()
1647 std::string name = "root_" + std::to_string(i); in TEST_F()
1650 std::string symbolLink = in TEST_F()
1669 std::string endpoint("truststore"); in TEST_F()
1670 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1673 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1698 std::string endpoint("ldap"); in TEST_F()
1701 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1713 object = std::string(objectNamePrefix) + '/' + in TEST_F()
1723 std::string endpoint("truststore"); in TEST_F()
1724 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1727 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1747 std::string endpoint("truststore"); in TEST_F()
1748 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1751 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1766 std::string endpoint("truststore"); in TEST_F()
1767 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1770 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1785 std::string endpoint("truststore"); in TEST_F()
1786 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1789 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1811 std::string endpoint("truststore"); in TEST_F()
1812 std::string verifyUnit(ManagerInTest::unitToRestartInTest); in TEST_F()
1815 std::string object = std::string(objectNamePrefix) + '/' + in TEST_F()
1831 std::vector<sdbusplus::message::object_path> objects = in TEST_F()