libqtaws
0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
|
Private implementation for AwsSignatureV3. More...
Public Member Functions | |
AwsSignatureV3Private (const QCryptographicHash::Algorithm hashAlgorithm, AwsSignatureV3 *const q) | |
Constructs a new AwsSignatureV3Private object. More... | |
void | setAuthorizationHeader (const AwsAbstractCredentials &credentials, const QNetworkAccessManager::Operation operation, QNetworkRequest &request, const QByteArray &payload) const |
Set authorization header on a network request. More... | |
void | setDateHeader (QNetworkRequest &request, const QDateTime &dateTime=QDateTime::currentDateTimeUtc()) const |
Set the AWS custom date header. More... | |
![]() | |
virtual | ~AwsAbstractSignaturePrivate () |
AwsAbstractSignaturePrivate destructor. More... | |
AwsAbstractSignaturePrivate (AwsAbstractSignature *const q) | |
Constructs a new AwsAbstractSignaturePrivate object. More... | |
QString | canonicalPath (const QUrl &url) const |
Create an AWS Signature canonical path. More... | |
QByteArray | canonicalQuery (const QUrlQuery &query) const |
Create an AWS Signature canonical query. More... | |
QString | httpMethod (const QNetworkAccessManager::Operation operation) const |
Create an AWS Signature request method string. More... | |
bool | setQueryItem (QUrlQuery &query, const QString &key, const QString &value, const bool warnOnNonIdenticalDuplicate=true) const |
Set a query item, checking for existing values first. More... | |
Protected Member Functions | |
QByteArray | algorithmDesignation (const QCryptographicHash::Algorithm algorithm) const |
Create an AWS V3 Signature algorithm designation. More... | |
QByteArray | authorizationHeaderValue (const AwsAbstractCredentials &credentials, const QNetworkAccessManager::Operation operation, QNetworkRequest &request, const QByteArray &payload) const |
Create an AWS V3 Signature authorization header value. More... | |
QByteArray | canonicalHeader (const QByteArray &headerName, const QByteArray &headerValue) const |
Create an AWS V3 Signature canonical header string. More... | |
QByteArray | canonicalHeaders (const QNetworkRequest &request, QByteArray *const signedHeaders) const |
Create an AWS V3 Signature canonical headers string. More... | |
QByteArray | canonicalRequest (const QNetworkAccessManager::Operation operation, const QNetworkRequest &request, const QByteArray &payload, QByteArray *const signedHeaders) const |
Create an AWS V3 Signature canonical request. More... | |
Static Protected Member Functions | |
static bool | isHttps (const QNetworkRequest &request) |
Does a request use the HTTPS scheme? More... | |
Protected Attributes | |
const QCryptographicHash::Algorithm | hashAlgorithm |
Hash algorithm to use when signing. | |
![]() | |
AwsAbstractSignature *const | q_ptr |
Internal q-pointer. | |
Friends | |
class | TestAwsSignatureV3 |
Private implementation for AwsSignatureV3.
Definition at line 36 of file awssignaturev3_p.h.
AwsSignatureV3Private::AwsSignatureV3Private | ( | const QCryptographicHash::Algorithm | hashAlgorithm, |
AwsSignatureV3 *const | q | ||
) |
Constructs a new AwsSignatureV3Private object.
hashAlgorithm | The algorithm to use during various stages of signing. |
q | Pointer to this object's public AwsSignatureV3 instance. |
Definition at line 98 of file awssignaturev3.cpp.
|
protected |
Create an AWS V3 Signature algorithm designation.
This function returns an algorithm designation, as defined by Amazon, for use with V3 signatures.
For example, if the algorith is QCryptographicHash::Sha256
, this function will return HmacSHA256
.
algorithm | The hash algorithm to get the canonical designation for. |
Definition at line 120 of file awssignaturev3.cpp.
Referenced by authorizationHeaderValue().
|
protected |
Create an AWS V3 Signature authorization header value.
This function builds a V3 signature, and returns it to the caller. The returned header value is then suitable for adding as an Authorization
header in the HTTP request, to be accepted by Amazon.
credentials | The AWS credentials to use to sign the request. |
operation | The HTTP method being used for the request. |
request | The network request to generate a signature for. |
payload | Optional data being submitted in the request (eg for PUT and POST operations). |
Definition at line 148 of file awssignaturev3.cpp.
References AwsAbstractCredentials::accessKeyId(), algorithmDesignation(), canonicalRequest(), hashAlgorithm, isHttps(), and AwsAbstractCredentials::secretKey().
Referenced by setAuthorizationHeader().
|
protected |
Create an AWS V3 Signature canonical header string.
In canonical form, header name and value are combined with a single semi-colon separator, with all whitespace removed from both, except for whitespace within double-quotes.
AWS3
format, not AWS3-HTTPS
.headerName | Name of the HTTP header to convert to canonical form. |
headerValue | Value of the HTTP header to convert to canonical form. |
Definition at line 192 of file awssignaturev3.cpp.
Referenced by canonicalHeaders().
|
protected |
Create an AWS V3 Signature canonical headers string.
This function constructs a canonical string containing all of the headers in the given request.
request
will typically not include a Host
header at this stage, however Qt will add an appropriate Host
header when the request is performed. So, if request
does not include a Host
header yet, this function will include a derived Host
header in the canonical headers to allow for it.AWS3
format, not AWS3-HTTPS
.[in] | request | The network request to fetch the canonical headers from. |
[out] | signedHeaders | A semi-colon separated list of the names of all headers included in the result. |
Definition at line 241 of file awssignaturev3.cpp.
References canonicalHeader().
Referenced by canonicalRequest().
|
protected |
Create an AWS V3 Signature canonical request.
Note, this function implments both AWS3
and AWS3-HTTPS
variants of the AWS Signature version 3 - which are quite different.
[in] | operation | The HTTP method being used for the request. |
[in] | request | The network request to generate a canonical request for. |
[in] | payload | Optional data being submitted in the request (eg for PUT and POST operations). |
[out] | signedHeaders | A semi-colon separated list of the names of all headers included in the result. |
Definition at line 292 of file awssignaturev3.cpp.
References canonicalHeaders(), AwsAbstractSignaturePrivate::canonicalPath(), AwsAbstractSignaturePrivate::canonicalQuery(), AwsAbstractSignaturePrivate::httpMethod(), and isHttps().
Referenced by authorizationHeaderValue().
|
inlinestaticprotected |
Does a request use the HTTPS scheme?
request | The network request to evaluate. |
true
if request uses the HTTPS scheme, false
otherwise. Definition at line 321 of file awssignaturev3.cpp.
Referenced by authorizationHeaderValue(), and canonicalRequest().
void AwsSignatureV3Private::setAuthorizationHeader | ( | const AwsAbstractCredentials & | credentials, |
const QNetworkAccessManager::Operation | operation, | ||
QNetworkRequest & | request, | ||
const QByteArray & | payload | ||
) | const |
Set authorization header on a network request.
This function will calculate the authorization header value and set it as the Authorization
HTTP header on request
.
[in] | credentials | The AWS credentials to use to sign the request. |
[in] | operation | The HTTP method being used for the request. |
[in,out] | request | The network request to add the authorization header to. |
[in] | payload | Optional data being submitted in the request (eg for PUT and POST operations). |
Definition at line 340 of file awssignaturev3.cpp.
References authorizationHeaderValue().
void AwsSignatureV3Private::setDateHeader | ( | QNetworkRequest & | request, |
const QDateTime & | dateTime = QDateTime::currentDateTimeUtc() |
||
) | const |
Set the AWS custom date header.
If request does not already contain an x-amz-date
header, then this function will set a custom x-amz-date
header to the value of dateTime
formatted like "Fri, 09 Sep 2011 23:36:00 GMT".
request | The network request to add the date header to. |
dateTime | The timestamp (in UTC) to set the date header's value to. |
Definition at line 358 of file awssignaturev3.cpp.