"Error=" << CKM::ErrorToString(tmp));
}
-RUNNER_TEST(T1812_deinit)
+RUNNER_TEST(T1812_negative_get_pkcs12_wrong_password)
+{
+ CKM::Alias alias = "t1812alias1";
+
+ auto manager = CKM::Manager::create();
+ std::ifstream is("/usr/share/ckm-test/pkcs.p12");
+ std::istreambuf_iterator<char> begin(is), end;
+ std::vector<char> buff(begin, end);
+
+ CKM::PKCS12ShPtr pkcs12;
+
+ CKM::RawBuffer buffer(buff.size());
+ memcpy(buffer.data(), buff.data(), buff.size());
+
+ auto pkcs = CKM::PKCS12::create(buffer, CKM::Password());
+ RUNNER_ASSERT_MSG_BT(
+ NULL != pkcs.get(),
+ "Error in PKCS12::create()");
+
+ int temp;
+ RUNNER_ASSERT_MSG_BT(
+ CKM_API_SUCCESS == (temp = manager->savePKCS12(alias, pkcs, CKM::Policy("easypass"), CKM::Policy("easypass"))),
+ "Error=" << CKM::ErrorToString(temp));
+
+ RUNNER_ASSERT_MSG_BT(
+ CKM_API_ERROR_AUTHENTICATION_FAILED == (temp = manager->getPKCS12(alias, pkcs)),
+ "Error=" << CKM::ErrorToString(temp));
+}
+
+RUNNER_TEST(T1813_deinit)
{
int temp;
auto control = CKM::Control::create();