Beispiel #1
0
        public void SignCanonicalRequestByHeaders()
        {
            var config = BuildBaseSigningConfig();

            config.SignedBodyHeader = AwsSignedBodyHeaderType.X_AMZ_CONTENT_SHA256;
            config.SignatureType    = AwsSignatureType.CANONICAL_REQUEST_VIA_HEADERS;


            var canonicalRequest = String.Join("\n",
                                               "POST",
                                               "/",
                                               "",
                                               "content-length:13",
                                               "content-type:application/x-www-form-urlencoded",
                                               "host:example.amazonaws.com",
                                               "x-amz-content-sha256:9095672bbd1f56dfc5b65f3e153adc8731a4a654192329106275f4c7b24d0b6e",
                                               "x-amz-date:20150830T123600Z",
                                               "",
                                               "content-length;content-type;host;x-amz-content-sha256;x-amz-date",
                                               "9095672bbd1f56dfc5b65f3e153adc8731a4a654192329106275f4c7b24d0b6e");

            CrtResult <String> result         = AwsSigner.SignCanonicalRequest(canonicalRequest, config);
            String             signatureValue = result.Get();

            Assert.Equal("d3875051da38690788ef43de4db0d8f280229d82040bfac253562e56c3f20e0b", signatureValue);
        }