The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Amazon::Signature::v4 - support for v4 of the Amazon signing method

VERSION

version 0.001

SYNOPSIS

 my $req = 'GET / HTTP/1.1 ...';
 my $amz = WebService::Amazon::Signature::v4->new(
  scope      => '20110909/us-east-1/host/aws4_request',
  access_key => 'AKIDEXAMPLE',
  secret_key => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
  host_port  => 'dynamodb.us-west-2.amazonaws.com',
 );
 $amz->parse_request($req)
 my $signed_req = $amz->signed_request($req);

DESCRIPTION

METHODS - Constructor

new

Instantiate a signing object. Expects the following named parameters:

  • scope - the scope used for requests, typically something like 20130112/us-west-2/dynamodb/aws4_request

  • secret_key - your secret key

  • access_key - your access key

  • host_port - the host and optional port info, will be something like dynamodb.us-west-2.amazonaws.com

METHODS - Accessors

algorithm

Read-only accessor for the algorithm (default is AWS4-HMAC-SHA256)

host_port

Read-only accessor for the host and optional port information, as a colon-separated string (e.g. localhost:8000).

date

Read-only accessor for the date field.

scope

Read-only accessor for scope information - typically something like 20110909/us-east-1/host/aws4_request.

access_key

Readonly accessor for the access key used when signing requests.

secret_key

Readonly accessor for the secret key used when signing requests.

signed_headers

Read-only accessor for the headers used for signing purposes (a string consisting of the lowercase headers separated by ; in lexical order)

METHODS

parse_request

Parses a given request. Takes a single parameter - the HTTP request as a string.

from_http_request

Parses information from an HTTP::Request instance.

canonical_request

Returns the string form of the canonical request, used as an intermediate point in generating the signature.

string_to_sign

Returns the \n-separated string as the last step before generating the signature itself.

calculate_signature

Calculates the signature for the current request and returns it as a string suitable for the Authorization header.

signed_request

Returns a signed version of the request.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2012-2013. Licensed under the same terms as Perl itself.