sshclient.cpp fix
This commit is contained in:
parent
4c690dd3c6
commit
de83db10d6
1 changed files with 6 additions and 4 deletions
|
|
@ -352,16 +352,18 @@ namespace libssh {
|
||||||
m_passphraseCallback = passphraseCallback;
|
m_passphraseCallback = passphraseCallback;
|
||||||
authResult = ssh_pki_import_privkey_base64(credentials.password.toStdString().c_str(), nullptr, callback, nullptr, &privateKey);
|
authResult = ssh_pki_import_privkey_base64(credentials.password.toStdString().c_str(), nullptr, callback, nullptr, &privateKey);
|
||||||
if (authResult == SSH_OK) {
|
if (authResult == SSH_OK) {
|
||||||
char* key = new char[65535];
|
char *b64 = nullptr;
|
||||||
|
|
||||||
authResult = ssh_pki_export_privkey_base64(privateKey, nullptr, nullptr, nullptr, &key);
|
authResult = ssh_pki_export_privkey_base64(privateKey, nullptr, nullptr, nullptr, &b64);
|
||||||
decryptedPrivateKey = key;
|
decryptedPrivateKey = QString(b64);
|
||||||
delete[] key;
|
|
||||||
|
|
||||||
if (authResult != SSH_OK) {
|
if (authResult != SSH_OK) {
|
||||||
qDebug() << "failed to export private key";
|
qDebug() << "failed to export private key";
|
||||||
errorCode = ErrorCode::InternalError;
|
errorCode = ErrorCode::InternalError;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ssh_string_free_char(b64);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errorCode = ErrorCode::SshPrivateKeyError;
|
errorCode = ErrorCode::SshPrivateKeyError;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue