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,10 +171,18 @@ std::string PasswordManager::encrypt(const std::string &name, const std::string
|
||||||
|
|
||||||
std::string PasswordManager::decrypt(const std::string &id, const std::string_view &encpwd)
|
std::string PasswordManager::decrypt(const std::string &id, const std::string_view &encpwd)
|
||||||
{
|
{
|
||||||
if (m_cryptoEngine) {
|
if (m_cryptoEngine)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
secure_vector<uint8_t> decoded = m_cryptoEngine->get(id, encpwd);
|
secure_vector<uint8_t> decoded = m_cryptoEngine->get(id, encpwd);
|
||||||
return std::string(reinterpret_cast<const char*>(decoded.data()), decoded.size());
|
return std::string(reinterpret_cast<const char*>(decoded.data()), decoded.size());
|
||||||
}
|
}
|
||||||
|
catch (const Botan::Exception &ex)
|
||||||
|
{
|
||||||
|
throw PasswordManagerException(ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw PasswordManagerLockedException();
|
throw PasswordManagerLockedException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue