added private key export without password to client config

This commit is contained in:
vladimir.kuznetsov 2023-04-03 17:27:55 +03:00
parent f3aef67be6
commit 5e099f522e
10 changed files with 76 additions and 56 deletions

View file

@ -46,7 +46,7 @@ ErrorCode ServerController::runScript(const ServerCredentials &credentials, QStr
const std::function<ErrorCode (const QString &, libssh::Client &)> &cbReadStdOut,
const std::function<ErrorCode (const QString &, libssh::Client &)> &cbReadStdErr) {
auto error = m_sshClient.connectToHost(credentials, m_passphraseCallback);
auto error = m_sshClient.connectToHost(credentials);
if (error != ErrorCode::NoError) {
return error;
}
@ -221,7 +221,7 @@ ErrorCode ServerController::checkOpenVpnServer(DockerContainer container, const
ErrorCode ServerController::uploadFileToHost(const ServerCredentials &credentials, const QByteArray &data, const QString &remotePath,
libssh::SftpOverwriteMode overwriteMode)
{
auto error = m_sshClient.connectToHost(credentials, m_passphraseCallback);
auto error = m_sshClient.connectToHost(credentials);
if (error != ErrorCode::NoError) {
return error;
}
@ -757,5 +757,11 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential
void ServerController::setPassphraseCallback(const std::function<QString()> &callback)
{
m_passphraseCallback = callback;
m_sshClient.setPassphraseCallback(callback);
}
ErrorCode ServerController::getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey)
{
auto error = m_sshClient.getDecryptedPrivateKey(credentials, decryptedPrivateKey);
return error;
}