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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to