Catch botan exception in password manager and throw higher level exception.
This commit is contained in:
parent
6d05c6d75a
commit
b5ca7099c1
1 changed files with 11 additions and 3 deletions
|
|
@ -171,9 +171,17 @@ std::string PasswordManager::encrypt(const std::string &name, const std::string
|
|||
|
||||
std::string PasswordManager::decrypt(const std::string &id, const std::string_view &encpwd)
|
||||
{
|
||||
if (m_cryptoEngine) {
|
||||
secure_vector<uint8_t> decoded = m_cryptoEngine->get(id, encpwd);
|
||||
return std::string(reinterpret_cast<const char*>(decoded.data()), decoded.size());
|
||||
if (m_cryptoEngine)
|
||||
{
|
||||
try
|
||||
{
|
||||
secure_vector<uint8_t> decoded = m_cryptoEngine->get(id, encpwd);
|
||||
return std::string(reinterpret_cast<const char*>(decoded.data()), decoded.size());
|
||||
}
|
||||
catch (const Botan::Exception &ex)
|
||||
{
|
||||
throw PasswordManagerException(ex.what());
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw PasswordManagerLockedException();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue