From 8ded86b99b7cf6ef6fddc222cfb88a3621a0c291 Mon Sep 17 00:00:00 2001 From: Bartlomiej Grzelewski Date: Wed, 4 Feb 2015 19:19:22 +0100 Subject: [PATCH] Add support for AUTHENTICATION_FAILED code in getData function. Function getPKCS12, getKey, getData will return proper code when password does not mach. Change-Id: I8b506f6c03f7acc5421278360cd839d059b914c2 --- src/manager/service/ckm-logic.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/manager/service/ckm-logic.cpp b/src/manager/service/ckm-logic.cpp index 8450f20..a685770 100644 --- a/src/manager/service/ckm-logic.cpp +++ b/src/manager/service/ckm-logic.cpp @@ -774,6 +774,9 @@ RawBuffer CKMLogic::getData( } catch (const KeyProvider::Exception::Base &e) { LogError("KeyProvider failed with error: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; + } catch (const CryptoLogic::Exception::DecryptDBRowError &e) { + LogError("CryptoLogic failed with message: " << e.GetMessage()); + retCode = CKM_API_ERROR_AUTHENTICATION_FAILED; } catch (const CryptoLogic::Exception::Base &e) { LogError("CryptoLogic failed with message: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; @@ -860,6 +863,9 @@ RawBuffer CKMLogic::getPKCS12( } catch (const KeyProvider::Exception::Base &e) { LogError("KeyProvider failed with error: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; + } catch (const CryptoLogic::Exception::DecryptDBRowError &e) { + LogError("CryptoLogic failed with message: " << e.GetMessage()); + retCode = CKM_API_ERROR_AUTHENTICATION_FAILED; } catch (const CryptoLogic::Exception::Base &e) { LogError("CryptoLogic failed with message: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; @@ -1307,6 +1313,9 @@ RawBuffer CKMLogic::createSignature( } catch (const KeyProvider::Exception::Base &e) { LogError("KeyProvider failed with message: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; + } catch (const CryptoLogic::Exception::DecryptDBRowError &e) { + LogError("CryptoLogic failed with message: " << e.GetMessage()); + retCode = CKM_API_ERROR_AUTHENTICATION_FAILED; } catch (const CryptoLogic::Exception::Base &e) { LogError("CryptoLogic failed with message: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; @@ -1376,6 +1385,9 @@ RawBuffer CKMLogic::verifySignature( } catch (const KeyProvider::Exception::Base &e) { LogError("KeyProvider failed with error: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; + } catch (const CryptoLogic::Exception::DecryptDBRowError &e) { + LogError("CryptoLogic failed with message: " << e.GetMessage()); + retCode = CKM_API_ERROR_AUTHENTICATION_FAILED; } catch (const CryptoLogic::Exception::Base &e) { LogError("CryptoLogic failed with message: " << e.GetMessage()); retCode = CKM_API_ERROR_SERVER_ERROR; -- 2.7.4