Documentation

SignatureV4
in package
implements SignatureInterface Uses SignatureTrait

Signature Version 4

Tags
link
http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

Interfaces, Classes and Traits

SignatureInterface
Interface used to provide interchangeable strategies for signing requests using the various AWS signature protocols.

Table of Contents

AMZ_CONTENT_SHA256_HEADER  = 'X-Amz-Content-Sha256'
ISO8601_BASIC  = 'Ymd\THis\Z'
UNSIGNED_PAYLOAD  = 'UNSIGNED-PAYLOAD'
$cache  : array<string|int, mixed>
$cacheSize  : int
$region  : string
$service  : string
$unsigned  : bool
__construct()  : mixed
convertPostToGet()  : RequestInterface
Converts a POST request to a GET request by moving POST fields into the query string.
presign()  : RequestInterface
Create a pre-signed request.
signRequest()  : RequestInterface
Signs the specified request with an AWS signing protocol by using the provided AWS account credentials and adding the required headers to the request.
createCanonicalizedPath()  : mixed
getPayload()  : mixed
getPresignedPayload()  : mixed
buildRequest()  : mixed
convertExpires()  : mixed
convertToTimestamp()  : mixed
createContext()  : array<string|int, mixed>
createPresignedRequest()  : mixed
createScope()  : mixed
createStringToSign()  : mixed
getCanonicalizedQuery()  : mixed
getHeaderBlacklist()  : array<string|int, mixed>
The following headers are not signed because signing these headers would potentially cause a signature mismatch when sending a request through a proxy or if modified at the HTTP client level.
getPresignHeaders()  : array<string|int, mixed>
Get the headers that were used to pre-sign the request.
getSigningKey()  : mixed
moveHeadersToQuery()  : mixed
parseRequest()  : mixed

Constants

AMZ_CONTENT_SHA256_HEADER

public mixed AMZ_CONTENT_SHA256_HEADER = 'X-Amz-Content-Sha256'

ISO8601_BASIC

public mixed ISO8601_BASIC = 'Ymd\THis\Z'

UNSIGNED_PAYLOAD

public mixed UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'

Properties

$cache

private array<string|int, mixed> $cache = []

Cache of previously signed values

Methods

__construct()

public __construct(string $service, string $region[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$service : string

Service name to use when signing

$region : string

Region name to use when signing

$options : array<string|int, mixed> = []

Array of configuration options used when signing

  • unsigned-body: Flag to make request have unsigned payload. Unsigned body is used primarily for streaming requests.
Return values
mixed

convertPostToGet()

Converts a POST request to a GET request by moving POST fields into the query string.

public static convertPostToGet(RequestInterface $request[, mixed $additionalQueryParams = "" ]) : RequestInterface

Useful for pre-signing query protocol requests.

Parameters
$request : RequestInterface

Request to clone

$additionalQueryParams : mixed = ""
Tags
throws
InvalidArgumentException

if the method is not POST

Return values
RequestInterface

presign()

Create a pre-signed request.

public presign(RequestInterface $request, CredentialsInterface $credentials, mixed $expires[, array<string|int, mixed> $options = [] ]) : RequestInterface
Parameters
$request : RequestInterface

Request to sign

$credentials : CredentialsInterface

Credentials used to sign

$expires : mixed

The time at which the URL should expire. This can be a Unix timestamp, a PHP DateTime object, or a string that can be evaluated by strtotime.

$options : array<string|int, mixed> = []
Return values
RequestInterface

createCanonicalizedPath()

protected createCanonicalizedPath(mixed $path) : mixed
Parameters
$path : mixed
Return values
mixed

buildRequest()

private buildRequest(array<string|int, mixed> $req) : mixed
Parameters
$req : array<string|int, mixed>
Return values
mixed

convertExpires()

private convertExpires(mixed $expiresTimestamp, mixed $startTimestamp) : mixed
Parameters
$expiresTimestamp : mixed
$startTimestamp : mixed
Return values
mixed

convertToTimestamp()

private convertToTimestamp(mixed $dateValue[, mixed $relativeTimeBase = null ]) : mixed
Parameters
$dateValue : mixed
$relativeTimeBase : mixed = null
Return values
mixed

createContext()

private createContext(array<string|int, mixed> $parsedRequest, string $payload) : array<string|int, mixed>
Parameters
$parsedRequest : array<string|int, mixed>
$payload : string

Hash of the request payload

Return values
array<string|int, mixed>

Returns an array of context information

createScope()

private createScope(mixed $shortDate, mixed $region, mixed $service) : mixed
Parameters
$shortDate : mixed
$region : mixed
$service : mixed
Return values
mixed

createStringToSign()

private createStringToSign(mixed $longDate, mixed $credentialScope, mixed $creq) : mixed
Parameters
$longDate : mixed
$credentialScope : mixed
$creq : mixed
Return values
mixed

getCanonicalizedQuery()

private getCanonicalizedQuery(array<string|int, mixed> $query) : mixed
Parameters
$query : array<string|int, mixed>
Return values
mixed

getHeaderBlacklist()

The following headers are not signed because signing these headers would potentially cause a signature mismatch when sending a request through a proxy or if modified at the HTTP client level.

private getHeaderBlacklist() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPresignHeaders()

Get the headers that were used to pre-sign the request.

private getPresignHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>

Used for the X-Amz-SignedHeaders header.

Parameters
$headers : array<string|int, mixed>
Return values
array<string|int, mixed>

getSigningKey()

private getSigningKey(mixed $shortDate, mixed $region, mixed $service, mixed $secretKey) : mixed
Parameters
$shortDate : mixed
$region : mixed
$service : mixed
$secretKey : mixed
Return values
mixed

moveHeadersToQuery()

private moveHeadersToQuery(array<string|int, mixed> $parsedRequest) : mixed
Parameters
$parsedRequest : array<string|int, mixed>
Return values
mixed

Search results