[fpc-pascal] AWS S3 RESTAuthentication
Marcos Douglas
md at delfire.net
Tue Jun 11 02:43:39 CEST 2013
Hi,
Someone know how translate the "code" bellow to Pascal?
http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
=== code ===
Authorization = "AWS" + " " + AWSAccessKeyId + ":" + Signature;
Signature = Base64( HMAC-SHA1( YourSecretAccessKeyID,
UTF-8-Encoding-Of( StringToSign ) ) );
StringToSign = HTTP-Verb + "\n" +
Content-MD5 + "\n" +
Content-Type + "\n" +
Date + "\n" +
CanonicalizedAmzHeaders +
CanonicalizedResource;
CanonicalizedResource = [ "/" + Bucket ] +
<HTTP-Request-URI, from the protocol name up to the query string> +
[ sub-resource, if present. For example "?acl", "?location",
"?logging", or "?torrent"];
CanonicalizedAmzHeaders = <described below>
=== code ===
I tried something like:
function StringToSign: string;
begin
Result := HTTPVerb + #10 // GET, PUT, etc
+ '' + #10 // ContentMD5
+ '' + #10 // ContentType
+ RfcDateValue + #10 // Date
+ '' // CanonicalizedAmzHeaders
+ '/'; //+BucketName; // CanonicalizedResource;
end;
function GetSignature: string;
begin
Result := EncodeBase64(HMACSHA1(FSecretKey, UTF8Encode(StringToSign)));
end;
Thank you very much.
Marcos Douglas
More information about the fpc-pascal
mailing list