Switched ConnectionConfig to QString from std::string to fit better into Qt framework

This commit is contained in:
eelke 2019-09-16 19:24:39 +02:00
parent bcfd82c27d
commit 082293e58a
20 changed files with 1077 additions and 211 deletions

View file

@ -61,14 +61,14 @@ public:
return base64_encode(wrapped_key);
}
secure_vector<uint8_t> get(const std::string& name, const std::string &wrapped_key) const
secure_vector<uint8_t> get(const std::string& name, const std::string_view &wrapped_key) const
{
const std::vector<uint8_t> wrapped_name =
nist_key_wrap_padded(cast_char_ptr_to_uint8(name.data()),
name.size(),
*m_cipher);
const secure_vector<uint8_t> val = base64_decode(wrapped_key);
const secure_vector<uint8_t> val = base64_decode(wrapped_key.data(), wrapped_key.size());
std::unique_ptr<BlockCipher> wrap_cipher(m_cipher->clone());
wrap_cipher->set_key(m_hmac->process(wrapped_name));
@ -169,7 +169,7 @@ std::string PasswordManager::encrypt(const std::string &name, const std::string
}
}
std::string PasswordManager::decrypt(const std::string &id, const std::string &encpwd)
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);

View file

@ -6,6 +6,7 @@
#include <QSqlDatabase>
#include <botan/secmem.h>
#include <string>
#include <string_view>
#include <tuple>
#include <memory>
@ -55,7 +56,7 @@ public:
bool locked() const;
std::string encrypt(const std::string &id, const std::string &passwd);
std::string decrypt(const std::string &id, const std::string &encpwd);
std::string decrypt(const std::string &id, const std::string_view &encpwd);
// void remove(const std::string &id);
private:
QString m_passwordTableName = "psk_passwd";