SSH Agent: Refactor entry and agent key management

- Remove duplicate code to load a key (EditEntryWidget & SSHAgent)
 - Refactor all key loading and saving to KeeAgentSettings
 - Depend only on Entry to allow future CLI expansion
This commit is contained in:
Toni Spets 2019-11-09 20:45:08 +02:00 committed by Jonathan White
parent c97ee5395b
commit e24a858f39
5 changed files with 196 additions and 152 deletions

View file

@ -19,6 +19,8 @@
#ifndef KEEAGENTSETTINGS_H
#define KEEAGENTSETTINGS_H
#include "core/Entry.h"
#include "crypto/ssh/OpenSSHKey.h"
#include <QXmlStreamReader>
#include <QtCore>
@ -27,12 +29,19 @@ class KeeAgentSettings
public:
KeeAgentSettings();
bool operator==(KeeAgentSettings& other);
bool operator!=(KeeAgentSettings& other);
bool isDefault();
bool operator==(const KeeAgentSettings& other) const;
bool operator!=(const KeeAgentSettings& other) const;
bool isDefault() const;
bool fromXml(const QByteArray& ba);
QByteArray toXml();
QByteArray toXml() const;
bool fromEntry(const Entry* entry);
void toEntry(Entry* entry) const;
bool keyConfigured() const;
bool toOpenSSHKey(const Entry* entry, OpenSSHKey& key, bool decrypt);
const QString errorString() const;
bool allowUseOfSshKey() const;
bool addAtDatabaseOpen() const;
@ -74,6 +83,7 @@ private:
QString m_attachmentName;
bool m_saveAttachmentToTempFile;
QString m_fileName;
QString m_error;
};
#endif // KEEAGENTSETTINGS_H