libqtaws
0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
|
Private implementation for AwsSignatureV4. More...
Public Member Functions | |
AwsSignatureV4Private (const QCryptographicHash::Algorithm hashAlgorithm, AwsSignatureV4 *const q) | |
Constructs a new AwsSignatureV4Private object. More... | |
void | setAuthorizationHeader (const AwsAbstractCredentials &credentials, const QNetworkAccessManager::Operation operation, QNetworkRequest &request, const QByteArray &payload, const QDateTime ×tamp) const |
Set authorization header on a network request. More... | |
QDateTime | 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 V4 Signature algorithm designation. More... | |
QByteArray | authorizationHeaderValue (const AwsAbstractCredentials &credentials, const QNetworkAccessManager::Operation operation, QNetworkRequest &request, const QByteArray &payload, const QDateTime ×tamp) const |
Create an AWS V4 Signature authorization header value. More... | |
QByteArray | canonicalHeader (const QByteArray &headerName, const QByteArray &headerValue) const |
Create an AWS V4 Signature canonical header string. More... | |
QByteArray | canonicalHeaders (const QNetworkRequest &request, QByteArray *const signedHeaders) const |
Create an AWS V4 Signature canonical headers string. More... | |
QByteArray | canonicalRequest (const QNetworkAccessManager::Operation operation, const QNetworkRequest &request, const QByteArray &payload, QByteArray *const signedHeaders) const |
Create an AWS V4 Signature canonical request. More... | |
QByteArray | credentialScope (const QDate &date, const QString ®ion, const QString &service) const |
Create an AWS V4 Signature credential scope. More... | |
QByteArray | signingKey (const AwsAbstractCredentials &credentials, const QDate &date, const QString ®ion, const QString &service) const |
Create an AWS V4 Signature signing key. More... | |
QByteArray | stringToSign (const QByteArray &algorithmDesignation, const QDateTime &requestDate, const QByteArray &credentialScope, const QByteArray &canonicalRequest) const |
Create an AWS V4 Signature string to sign. More... | |
Protected Attributes | |
const QCryptographicHash::Algorithm | hashAlgorithm |
Hash algorithm to use when signing. | |
![]() | |
AwsAbstractSignature *const | q_ptr |
Internal q-pointer. | |
Static Protected Attributes | |
static const QLatin1String | DateFormat |
Format V4 signatures use to represent dates in canonical form. | |
static const QLatin1String | DateTimeFormat |
Format V4 signatures use to represent timestamps in canonical form. | |
Friends | |
class | TestAwsSignatureV4 |
Private implementation for AwsSignatureV4.
Definition at line 36 of file awssignaturev4_p.h.
AwsSignatureV4Private::AwsSignatureV4Private | ( | const QCryptographicHash::Algorithm | hashAlgorithm, |
AwsSignatureV4 *const | q | ||
) |
Constructs a new AwsSignatureV4Private object.
hashAlgorithm | The algorithm to use during various stages of signing. |
q | Pointer to this object's public AwsSignatureV4 instance. |
Definition at line 95 of file awssignaturev4.cpp.
|
protected |
Create an AWS V4 Signature algorithm designation.
This function returns an algorithm designation, as defined by Amazon, for use with V4 signatures.
For example, if the algorith is QCryptographicHash::Sha256
, this function will return AWS4-HMAC-SHA256
.
algorithm | The hash algorithm to get the canonical designation for. |
Definition at line 117 of file awssignaturev4.cpp.
Referenced by authorizationHeaderValue().
|
protected |
Create an AWS V4 Signature authorization header value.
This function builds an V4 signature, and returns it to the caller. The returned header value is then suitable for adding as a 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). |
timestamp | The timestamp to use when signing the request. |
Definition at line 151 of file awssignaturev4.cpp.
References AwsAbstractCredentials::accessKeyId(), algorithmDesignation(), canonicalRequest(), credentialScope(), hashAlgorithm, signingKey(), and stringToSign().
Referenced by setAuthorizationHeader().
|
protected |
Create an AWS V4 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.
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 186 of file awssignaturev4.cpp.
Referenced by canonicalHeaders().
|
protected |
Create an AWS V4 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.[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 233 of file awssignaturev4.cpp.
References canonicalHeader().
Referenced by canonicalRequest().
|
protected |
Create an AWS V4 Signature canonical request.
[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 274 of file awssignaturev4.cpp.
References canonicalHeaders(), AwsAbstractSignaturePrivate::canonicalPath(), AwsAbstractSignaturePrivate::canonicalQuery(), hashAlgorithm, and AwsAbstractSignaturePrivate::httpMethod().
Referenced by authorizationHeaderValue().
|
protected |
Create an AWS V4 Signature credential scope.
date | Date to include in the credential scope. |
region | Region name to include in the credential scope. |
service | Service name to include in the credential scope. |
Definition at line 297 of file awssignaturev4.cpp.
References DateFormat.
Referenced by authorizationHeaderValue().
void AwsSignatureV4Private::setAuthorizationHeader | ( | const AwsAbstractCredentials & | credentials, |
const QNetworkAccessManager::Operation | operation, | ||
QNetworkRequest & | request, | ||
const QByteArray & | payload, | ||
const QDateTime & | timestamp | ||
) | 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). |
[in] | timestamp | The timestamp to use when signing the request. |
Definition at line 317 of file awssignaturev4.cpp.
References authorizationHeaderValue().
QDateTime AwsSignatureV4Private::setDateHeader | ( | QNetworkRequest & | request, |
const QDateTime & | dateTime = QDateTime::currentDateTimeUtc() |
||
) | const |
Set the AWS custom date header.
This function will set a custom x-amz-date
header to the value of dateTime
formatted to AwsSignatureV4Private::DateTimeFormat.
request | The network request to add the date header to. |
dateTime | The timestamp to set the date header's value to. |
dateTime
verbatim (just a convenience for some callers). Definition at line 339 of file awssignaturev4.cpp.
References DateTimeFormat.
|
protected |
Create an AWS V4 Signature signing key.
credentials | AWS credentials to use when generating the signing key. |
date | Date to include in the signing key. |
region | Region name to include in the signing key. |
service | Service name to include in the signing key. |
Definition at line 358 of file awssignaturev4.cpp.
References DateFormat, hashAlgorithm, and AwsAbstractCredentials::secretKey().
Referenced by authorizationHeaderValue().
|
protected |
Create an AWS V4 Signature string to sign.
algorithmDesignation | AWS designation for the hash algorithm used to sign the request. |
requestDate | AWS request timestamp. |
credentialScope | Aws credential scope used to sign the request. |
canonicalRequest | AWS request in canonical form. |
Definition at line 383 of file awssignaturev4.cpp.
References DateTimeFormat, and hashAlgorithm.
Referenced by authorizationHeaderValue().