summaryrefslogtreecommitdiff
path: root/src/libs/ssh/sshkeyexchange.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-10-16 15:07:35 +0200
committerhjk <qthjk@ovi.com>2013-01-08 11:22:24 +0100
commit869a51fd6f1870c3dd08f62843be7f6b04d02ac9 (patch)
tree9d32366637301f2b86ca2d700f4603935c708f93 /src/libs/ssh/sshkeyexchange.cpp
parent050dbabd2349db740adf14a1bb14cebf1e3b66fc (diff)
downloadqt-creator-869a51fd6f1870c3dd08f62843be7f6b04d02ac9.tar.gz
Revert "SSH: Work around issue with dynamic_cast."
This reverts commit 6f7ce3f48e2ac4ebe5e04492b11d3a70bed37fb2. The workaround turned out to be incomplete and has therefore been superseded. Change-Id: Ic60cd810f72ca833c1725024d2816baf5ce47372 Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/libs/ssh/sshkeyexchange.cpp')
-rw-r--r--src/libs/ssh/sshkeyexchange.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/libs/ssh/sshkeyexchange.cpp b/src/libs/ssh/sshkeyexchange.cpp
index 6627ff9662..5a78cb0093 100644
--- a/src/libs/ssh/sshkeyexchange.cpp
+++ b/src/libs/ssh/sshkeyexchange.cpp
@@ -135,7 +135,8 @@ bool SshKeyExchange::sendDhInitPacket(const SshIncomingPacket &serverKexInit)
kexInitParams.compressionAlgorithmsServerToClient.names);
AutoSeeded_RNG rng;
- m_dhKey = createDhPrivateKey(rng, DL_Group(botanKeyExchangeAlgoName(keyAlgo)));
+ m_dhKey.reset(new DH_PrivateKey(rng,
+ DL_Group(botanKeyExchangeAlgoName(keyAlgo))));
m_serverKexInitPayload = serverKexInit.payLoad();
m_sendFacility.sendKeyDhInitPacket(m_dhKey->get_y());
@@ -182,24 +183,28 @@ void SshKeyExchange::sendNewKeysPacket(const SshIncomingPacket &dhReply,
printData("H", m_h);
#endif // CREATOR_SSH_DEBUG
- QSharedPointer<Public_Key> publicKey;
- QByteArray algorithm;
+ QScopedPointer<Public_Key> sigKey;
+ QScopedPointer<PK_Verifier> verifier;
if (m_serverHostKeyAlgo == SshCapabilities::PubKeyDss) {
const DL_Group group(reply.parameters.at(0), reply.parameters.at(1),
reply.parameters.at(2));
- publicKey = createDsaPublicKey(group, reply.parameters.at(3));
- algorithm = SshCapabilities::PubKeyDss;
+ DSA_PublicKey * const dsaKey
+ = new DSA_PublicKey(group, reply.parameters.at(3));
+ sigKey.reset(dsaKey);
+ verifier.reset(new PK_Verifier(*dsaKey, botanEmsaAlgoName(SshCapabilities::PubKeyDss)));
} else if (m_serverHostKeyAlgo == SshCapabilities::PubKeyRsa) {
- publicKey = createRsaPublicKey(reply.parameters.at(1), reply.parameters.at(0));
- algorithm = SshCapabilities::PubKeyRsa;
+ RSA_PublicKey * const rsaKey
+ = new RSA_PublicKey(reply.parameters.at(1), reply.parameters.at(0));
+ sigKey.reset(rsaKey);
+ verifier.reset(new PK_Verifier(*rsaKey, botanEmsaAlgoName(SshCapabilities::PubKeyRsa)));
} else {
Q_ASSERT(!"Impossible: Neither DSS nor RSA!");
}
const byte * const botanH = convertByteArray(m_h);
const Botan::byte * const botanSig
= convertByteArray(reply.signatureBlob);
- if (!PK_Verifier(*publicKey, botanEmsaAlgoName(algorithm)).verify_message(botanH, m_h.size(),
- botanSig, reply.signatureBlob.size())) {
+ if (!verifier->verify_message(botanH, m_h.size(), botanSig,
+ reply.signatureBlob.size())) {
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_KEY_EXCHANGE_FAILED,
"Invalid signature in SSH_MSG_KEXDH_REPLY packet.");
}