Beispiel #1
0
func (s *S) TestBasicSignature(c *C) {
	params := map[string]string{}
	ec2.Sign(testAuth, "GET", "/path", params, "localhost")
	c.Assert(params["SignatureVersion"], Equals, "2")
	c.Assert(params["SignatureMethod"], Equals, "HmacSHA256")
	expected := "6lSe5QyXum0jMVc7cOUz32/52ZnL7N5RyKRk/09yiK4="
	c.Assert(params["Signature"], Equals, expected)
}
Beispiel #2
0
func (s *S) TestSignatureExample1(c *C) {
	params := map[string]string{
		"Timestamp": "2009-02-01T12:53:20+00:00",
		"Version":   "2007-11-07",
		"Action":    "ListDomains",
	}
	ec2.Sign(aws.Auth{"access", "secret"}, "GET", "/", params, "sdb.amazonaws.com")
	expected := "okj96/5ucWBSc1uR2zXVfm6mDHtgfNv657rRtt/aunQ="
	c.Assert(params["Signature"], Equals, expected)
}
Beispiel #3
0
func (s *S) TestParamSignature(c *C) {
	params := map[string]string{
		"param1": "value1",
		"param2": "value2",
		"param3": "value3",
	}
	ec2.Sign(testAuth, "GET", "/path", params, "localhost")
	expected := "XWOR4+0lmK8bD8CGDGZ4kfuSPbb2JibLJiCl/OPu1oU="
	c.Assert(params["Signature"], Equals, expected)
}
Beispiel #4
0
func (s *S) TestEscaping(c *C) {
	params := map[string]string{"Nonce": "+ +"}
	ec2.Sign(testAuth, "GET", "/path", params, "localhost")
	expected := "bqffDELReIqwjg/W0DnsnVUmfLK4wXVLO4/LuG+1VFA="
	c.Assert(params["Signature"], Equals, expected)
}