Exemplo n.º 1
0
        public async Task CanonicalRequestCreatedHasherTest()
        {
            var signer  = new AwsSigner();
            var request = Helpers.CreateExampleRequest();

            var inputBuilder = new StringBuilder();

            inputBuilder.Append("GET\n");
            inputBuilder.Append("/\n");
            inputBuilder.Append("Action=ListUsers&Version=2010-05-08\n");
            inputBuilder.Append("content-type:application/x-www-form-urlencoded; charset=utf-8\n");
            inputBuilder.Append("host:iam.amazonaws.com\n");
            inputBuilder.Append("x-amz-date:20150830T123600Z\n");
            inputBuilder.Append("\n");
            inputBuilder.Append("content-type;host;x-amz-date\n");
            inputBuilder.Append("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");

            var canonicalRequest = await signer.BuildCanonicalRequest(request);

            Assert.AreEqual(inputBuilder.ToString(), canonicalRequest, "Request are not equal");

            var          output   = signer.HashText(canonicalRequest);
            const string expected = "f536975d06c0309214f805bb90ccff089219ecd68b2577efef23edd43b7e1a59";

            Assert.AreEqual(expected, output, "Hash content failed");
        }
Exemplo n.º 2
0
        public void PayloadHashTest()
        {
            var signer = new AwsSigner();

            var inputBuilder = new StringBuilder();

            inputBuilder.Append("");

            const string expected = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";

            var output = signer.HashText(inputBuilder.ToString());

            Assert.AreEqual(expected, output, "Payload hash failed");
        }