ValidatorConfig::ValidatorConfig(std::unique_ptr<v2::CertificateFetcher> fetcher, const Options& options) : v2::Validator(make_unique<v2::ValidationPolicyCommandInterest>(make_unique<v2::ValidationPolicyConfig>(), options), std::move(fetcher)) , m_policyConfig(static_cast<v2::ValidationPolicyConfig&>(getPolicy().getInnerPolicy())) { }
void PolicyServicesPlatformNotification::notifyPlatformPolicyReleaseControl() { throwIfNotWorkItemThread(); executeOsc(getPolicy()->getGuid(), OscActionReleaseControl); }
void benchmarkLW(Lw10 & lw, ofstream & outfile1, ofstream & outfile2, int attributeCount, int iterationCount, CharmListStr & keygenResults, CharmListStr & decryptResults) { Benchmark benchT, benchD, benchK; CharmMetaList msk, pk; CharmList gpk, sk, sk2, ct; CharmListStr authS, userS; // set this GT M, newM; string gid = "*****@*****.**"; // , policy_str = "((ATTR4 or ATTR3) and (ATTR2 or ATTR1))"; // set this double de_in_ms; getAttributes(authS, attributeCount); getAttributes(userS, attributeCount); // getAttributes(authS, attributeCount); string policy_str = getPolicy(attributeCount); // get a policy string lw.setup(gpk); lw.authsetup(gpk, authS, msk, pk); for(int i = 0; i < iterationCount; i++) { benchK.start(); lw.keygen(gpk, msk, gid, userS, sk2); benchK.stop(); double kg_in_ms = benchK.computeTimeInMilliseconds(); } cout << "Keygen avg: " << benchK.getAverage() << " ms" << endl; stringstream s1; s1 << attributeCount << " " << benchK.getAverage() << endl; outfile1 << s1.str(); keygenResults[attributeCount] = benchK.getRawResultString(); lw.keygen(gpk, msk, gid, userS, sk); M = lw.group.random(GT_t); lw.encrypt(pk, gpk, M, policy_str, ct); stringstream s2; for(int i = 0; i < iterationCount; i++) { // run Decrypt benchD.start(); lw.decrypt(sk, userS, ct, newM); benchD.stop(); de_in_ms = benchD.computeTimeInMilliseconds(); //cout << i << ": Raw DE: " << de_in_ms << endl; } cout << "Decout avg: " << benchD.getAverage() << endl; s2 << attributeCount << " " << benchD.getAverage() << endl; outfile2 << s2.str(); decryptResults[attributeCount] = benchD.getRawResultString(); // cout << convert_str(M) << endl; // cout << convert_str(newM) << endl; if(M == newM) { cout << "Successful Decryption!" << endl; } else { cout << "FAILED Decryption." << endl; } return; }
void benchmarkBSW(Bsw07 & bsw, ofstream & outfile0, ofstream & outfile1, ofstream & outfile2, int attributeCount, int iterationCount, CharmListStr & keygenResults, CharmListStr & transformResults, CharmListStr & decoutResults) { Benchmark benchT, benchD, benchK; CharmList mk, pk, skBlinded, skBlinded2, ct, transformOutputList; CharmListStr S; GT M, newM; ZR uf0, bf0; stringstream s0; double tf_in_ms, de_in_ms, kg_in_ms; bsw.setup(mk, pk); getAttributes(S, attributeCount); // BENCHMARK KEYGEN SETUP for(int i = 0; i < iterationCount; i++) { benchK.start(); bsw.keygen(pk, mk, S, uf0, bf0, skBlinded2); benchK.stop(); kg_in_ms = benchK.computeTimeInMilliseconds(); } cout << "Keygen avg: " << benchK.getAverage() << " ms" << endl; s0 << attributeCount << " " << benchK.getAverage() << endl; outfile0 << s0.str(); keygenResults[attributeCount] = benchK.getRawResultString(); // BENCHMARK KEYGEN SETUP bsw.keygen(pk, mk, S, uf0, bf0, skBlinded); M = bsw.group.random(GT_t); string policy_str = getPolicy(attributeCount); // get a policy string bsw.encrypt(pk, M, policy_str, ct); stringstream s1, s2; //cout << "ct =\n" << ct << endl; for(int i = 0; i < iterationCount; i++) { // run TRANSFORM benchT.start(); bsw.transform(pk, skBlinded, S, ct, transformOutputList); benchT.stop(); //cout << "transformCT =\n" << transformOutputList << endl; tf_in_ms = benchT.computeTimeInMilliseconds(); benchD.start(); bsw.decout(pk, S, transformOutputList, bf0, uf0, newM); benchD.stop(); de_in_ms = benchD.computeTimeInMilliseconds(); } cout << "Transform avg: " << benchT.getAverage() << endl; s1 << attributeCount << " " << benchT.getAverage() << endl; outfile1 << s1.str(); transformResults[attributeCount] = benchT.getRawResultString(); cout << "Decout avg: " << benchD.getAverage() << endl; s2 << attributeCount << " " << benchD.getAverage() << endl; outfile2 << s2.str(); decoutResults[attributeCount] = benchD.getRawResultString(); // measure ciphertext size cout << "CT size: " << measureSize(ct) << " bytes" << endl; cout << "CTOut size: " << measureSize(transformOutputList) << " bytes" << endl; // cout << convert_str(M) << endl; // cout << convert_str(newM) << endl; if(M == newM) { cout << "Successful Decryption!" << endl; } else { cout << "FAILED Decryption." << endl; } return; }