int saveKey(const Alias &alias, const Key &key, const Policy &policy);
int saveCertificate(const Alias &alias, const Certificate &cert, const Policy &policy);
+
+ /*
+ * Data must be extractable. If you set extractable bit to false funciton will
+ * return ERROR_INPUT_PARAM.
+ */
int saveData(const Alias &alias, const RawBuffer &data, const Policy &policy);
int removeKey(const Alias &alias);
}
int Manager::ManagerImpl::saveKey(const Alias &alias, const Key &key, const Policy &policy) {
+ if (key.empty())
+ return KEY_MANAGER_API_ERROR_INPUT_PARAM;
return saveBinaryData(alias, toDBDataType(key.getType()), key.getDER(), policy);
}
}
int Manager::ManagerImpl::saveData(const Alias &alias, const RawBuffer &rawData, const Policy &policy) {
+ if (!policy.extractable)
+ return KEY_MANAGER_API_ERROR_INPUT_PARAM;
return saveBinaryData(alias, DBDataType::BINARY_DATA, rawData, policy);
}