Line data Source code
1 : /*
2 : Copyright 2013-2015 Paul Colby
3 :
4 : This file is part of libqtaws.
5 :
6 : Libqtaws is free software: you can redistribute it and/or modify
7 : it under the terms of the GNU Lesser General Public License as published by
8 : the Free Software Foundation, either version 3 of the License, or
9 : (at your option) any later version.
10 :
11 : Libqtaws is distributed in the hope that it will be useful,
12 : but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : GNU Lesser General Public License for more details.
15 :
16 : You should have received a copy of the GNU Lesser General Public License
17 : along with libqtaws. If not, see <http://www.gnu.org/licenses/>.
18 : */
19 :
20 : #ifndef AWSSIGNATUREV3_P_H
21 : #define AWSSIGNATUREV3_P_H
22 :
23 : #include "qtawsglobal.h"
24 : #include "awsabstractsignature_p.h"
25 :
26 : #include <QCryptographicHash>
27 : #include <QDateTime>
28 : #include <QNetworkAccessManager>
29 : #include <QUrl>
30 : #include <QUrlQuery>
31 :
32 : QTAWS_BEGIN_NAMESPACE
33 :
34 : class AwsSignatureV3;
35 :
36 116 : class QTAWS_EXPORT AwsSignatureV3Private : public AwsAbstractSignaturePrivate {
37 :
38 : public:
39 : AwsSignatureV3Private(const QCryptographicHash::Algorithm hashAlgorithm, AwsSignatureV3 * const q);
40 :
41 : void setAuthorizationHeader(const AwsAbstractCredentials &credentials,
42 : const QNetworkAccessManager::Operation operation,
43 : QNetworkRequest &request, const QByteArray &payload) const;
44 :
45 : void setDateHeader(QNetworkRequest &request, const QDateTime &dateTime = QDateTime::currentDateTimeUtc()) const;
46 :
47 : protected:
48 : const QCryptographicHash::Algorithm hashAlgorithm; ///< Hash algorithm to use when signing.
49 :
50 : QByteArray algorithmDesignation(const QCryptographicHash::Algorithm algorithm) const;
51 :
52 : QByteArray authorizationHeaderValue(const AwsAbstractCredentials &credentials,
53 : const QNetworkAccessManager::Operation operation,
54 : QNetworkRequest &request, const QByteArray &payload) const;
55 :
56 : QByteArray canonicalHeader(const QByteArray &headerName, const QByteArray &headerValue) const;
57 :
58 : QByteArray canonicalHeaders(const QNetworkRequest &request, QByteArray * const signedHeaders) const;
59 :
60 : QByteArray canonicalRequest(const QNetworkAccessManager::Operation operation, const QNetworkRequest &request,
61 : const QByteArray &payload, QByteArray * const signedHeaders) const;
62 :
63 : static inline bool isHttps(const QNetworkRequest &request);
64 :
65 : private:
66 : Q_DECLARE_PUBLIC(AwsSignatureV3)
67 : friend class TestAwsSignatureV3;
68 : };
69 :
70 : QTAWS_END_NAMESPACE
71 :
72 : #endif
|