OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / utils / ssh / sshkeyexchange_p.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef SSHKEYEXCHANGE_P_H
34 #define SSHKEYEXCHANGE_P_H
35
36 #include <botan/dh.h>
37
38 #include <QtCore/QByteArray>
39 #include <QtCore/QScopedPointer>
40
41 namespace Botan { class HashFunction; }
42
43 namespace Utils {
44 namespace Internal {
45
46 class SshSendFacility;
47 class SshIncomingPacket;
48
49 class SshKeyExchange
50 {
51 public:
52     SshKeyExchange(SshSendFacility &sendFacility);
53     ~SshKeyExchange();
54
55     void sendKexInitPacket(const QByteArray &serverId);
56
57     // Returns true <=> the server sends a guessed package.
58     bool sendDhInitPacket(const SshIncomingPacket &serverKexInit);
59
60     void sendNewKeysPacket(const SshIncomingPacket &dhReply,
61         const QByteArray &clientId);
62
63     QByteArray k() const { return m_k; }
64     QByteArray h() const { return m_h; }
65     Botan::HashFunction *hash() const { return m_hash.data(); }
66     QByteArray encryptionAlgo() const { return m_encryptionAlgo; }
67     QByteArray decryptionAlgo() const { return m_decryptionAlgo; }
68     QByteArray hMacAlgoClientToServer() const { return m_c2sHMacAlgo; }
69     QByteArray hMacAlgoServerToClient() const { return m_s2cHMacAlgo; }
70
71 private:
72     QByteArray m_serverId;
73     QByteArray m_clientKexInitPayload;
74     QByteArray m_serverKexInitPayload;
75     QScopedPointer<Botan::DH_PrivateKey> m_dhKey;
76     QByteArray m_k;
77     QByteArray m_h;
78     QByteArray m_serverHostKeyAlgo;
79     QByteArray m_encryptionAlgo;
80     QByteArray m_decryptionAlgo;
81     QByteArray m_c2sHMacAlgo;
82     QByteArray m_s2cHMacAlgo;
83     QScopedPointer<Botan::HashFunction> m_hash;
84     SshSendFacility &m_sendFacility;
85 };
86
87 } // namespace Internal
88 } // namespace Utils
89
90 #endif // SSHKEYEXCHANGE_P_H