"Error=" << CKM::APICodeToString(temp));
}
+RUNNER_CHILD_TEST(G02T06_ExtendedPositive) {
+ // We are oridinary user with proper privileges.
+ PS ps("PkgIdG02T06", "UserG02T06", PrivCKMExtended);
+ ps.Apply();
+
+ int temp;
+ auto manager = CKM::Manager::create();
+ const CKM::CryptoAlgorithm params;
+ const CKM::Alias wrappingKeyAlias;
+ const CKM::Password wrappingKeyPassword;
+ const CKM::Alias alias;
+ const CKM::Password password;
+ CKM::RawBuffer data;
+ CKM::RawBuffer wrappedKey;
+
+ // We pass invalid data so we expect an error but it should not be ACCESS_DENIED as we have
+ // proper privileges
+ RUNNER_ASSERT_MSG(
+ CKM_API_ERROR_ACCESS_DENIED != (temp = manager->wrapConcatenatedData(
+ params, wrappingKeyAlias, wrappingKeyPassword, alias, password, data, wrappedKey)),
+ "Error=" << CKM::APICodeToString(temp));
+
+ RUNNER_ASSERT_MSG(
+ CKM_API_ERROR_ACCESS_DENIED != (temp = manager->unwrapConcatenatedData(
+ params, wrappingKeyAlias, wrappingKeyPassword, wrappedKey, alias, 0, CKM::Policy(), data)),
+ "Error=" << CKM::APICodeToString(temp));
+}
+
+RUNNER_CHILD_TEST(G02T07_ExtendedNegative) {
+ // We have wrong privilege.
+ // Cynara should deny all accesses to the extended API.
+ PS ps("PkgIdG02T07", "UserG02T07", PrivCKMStore);
+ ps.Apply();
+
+ int temp;
+ auto manager = CKM::Manager::create();
+ const CKM::CryptoAlgorithm params;
+ const CKM::Alias wrappingKeyAlias;
+ const CKM::Password wrappingKeyPassword;
+ const CKM::Alias alias;
+ const CKM::Password password;
+ CKM::RawBuffer data;
+ CKM::RawBuffer wrappedKey;
+
+ // We expect to receive ACCESS_DENIED before the actual logic function is called (which would
+ // return a different error because we pass invalid parameters)
+ RUNNER_ASSERT_MSG(
+ CKM_API_ERROR_ACCESS_DENIED == (temp = manager->wrapConcatenatedData(
+ params, wrappingKeyAlias, wrappingKeyPassword, alias, password, data, wrappedKey)),
+ "Error=" << CKM::APICodeToString(temp));
+
+ RUNNER_ASSERT_MSG(
+ CKM_API_ERROR_ACCESS_DENIED == (temp = manager->unwrapConcatenatedData(
+ params, wrappingKeyAlias, wrappingKeyPassword, wrappedKey, alias, 0,
+ CKM::Policy(), data)),
+ "Error=" << CKM::APICodeToString(temp));
+}