- int retCode;
- if (0 == m_userDataMap.count(cred.uid))
- retCode = CKM_API_ERROR_DB_LOCKED;
- else
- {
- try {
- // check if data is correct
- retCode = verifyBinaryData(dataType, data);
- if(retCode == CKM_API_SUCCESS)
- {
- retCode = saveDataHelper(cred, name, label, dataType, data, policy);
- }
- } catch (const KeyProvider::Exception::Base &e) {
- LogError("KeyProvider failed with message: " << e.GetMessage());
- retCode = CKM_API_ERROR_SERVER_ERROR;
- } catch (const CryptoLogic::Exception::Base &e) {
- LogError("CryptoLogic failed with message: " << e.GetMessage());
- retCode = CKM_API_ERROR_SERVER_ERROR;
- } catch (const DB::Crypto::Exception::InternalError &e) {
- LogError("DB::Crypto failed with message: " << e.GetMessage());
- retCode = CKM_API_ERROR_DB_ERROR;
- } catch (const DB::Crypto::Exception::TransactionError &e) {
- LogError("DB::Crypto transaction failed with message " << e.GetMessage());
- retCode = CKM_API_ERROR_DB_ERROR;
- } catch (const FileSystem::Exception::Base &e) {
- LogError("Error in FileSystem " << e.GetMessage());
- retCode = CKM_API_ERROR_FILE_SYSTEM;
- } catch (const CKM::Exception &e) {
- LogError("CKM::Exception: " << e.GetMessage());
- retCode = CKM_API_ERROR_SERVER_ERROR;
+ int retCode = CKM_API_ERROR_UNKNOWN;
+
+ try {
+ // check if data is correct
+ RawBuffer binaryData;
+ retCode = toBinaryData(dataType, data, binaryData);
+ if(retCode == CKM_API_SUCCESS)
+ {
+ retCode = saveDataHelper(cred, name, label, dataType, binaryData, policy);