SDK for PHP V3

CookieSigner
in package

Table of Contents

Methods

__construct()  : mixed
getSignedCookie()  : array<string|int, mixed>
Create a signed Amazon CloudFront Cookie.

Methods

__construct()

public __construct(string $keyPairId, string $privateKey[, int|string $algorithm = Signer::DEFAULT_ALGORITHM ]) : mixed
Parameters
$keyPairId : string

ID of the key pair.

$privateKey : string

Path to the private key used for signing, or a PEM-encoded key string.

$algorithm : int|string = Signer::DEFAULT_ALGORITHM

Signing hash algorithm. Accepts either an OpenSSL constant (OPENSSL_ALGO_SHA1, OPENSSL_ALGO_SHA256) or the canonical name string ("SHA1", "SHA256"). Defaults to SHA1.

Tags
throws
RuntimeException

if the openssl extension is missing.

throws
InvalidArgumentException

if the private key cannot be found, the key type is not supported by CloudFront (RSA or ECDSA P-256), or the requested algorithm is not supported.

getSignedCookie()

Create a signed Amazon CloudFront Cookie.

public getSignedCookie([string $url = null ][, string|int|null $expires = null ][, string $policy = null ]) : array<string|int, mixed>
Parameters
$url : string = null

URL to sign (can include query string and wildcards). Not required when passing a custom $policy.

$expires : string|int|null = null

UTC Unix timestamp used when signing with a canned policy. Not required when passing a custom $policy.

$policy : string = null

JSON policy. Use this option when creating a signed cookie for a custom policy.

Tags
throws
InvalidArgumentException

if the URL provided is invalid

link
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-cookies.html
Return values
array<string|int, mixed>

The authenticated cookie parameters

<-- modeled_exceptions -->
On this page