summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/goamz/goamz/ec2/sign.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/goamz/goamz/ec2/sign.go')
-rw-r--r--vendor/github.com/goamz/goamz/ec2/sign.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/vendor/github.com/goamz/goamz/ec2/sign.go b/vendor/github.com/goamz/goamz/ec2/sign.go
deleted file mode 100644
index 1c30f13bb..000000000
--- a/vendor/github.com/goamz/goamz/ec2/sign.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package ec2
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/base64"
- "github.com/goamz/goamz/aws"
- "sort"
- "strings"
-)
-
-// ----------------------------------------------------------------------------
-// EC2 signing (http://goo.gl/fQmAN)
-
-var b64 = base64.StdEncoding
-
-func sign(auth aws.Auth, method, path string, params map[string]string, host string) {
- params["AWSAccessKeyId"] = auth.AccessKey
- params["SignatureVersion"] = "2"
- params["SignatureMethod"] = "HmacSHA256"
- if auth.Token() != "" {
- params["SecurityToken"] = auth.Token()
- }
-
- // AWS specifies that the parameters in a signed request must
- // be provided in the natural order of the keys. This is distinct
- // from the natural order of the encoded value of key=value.
- // Percent and equals affect the sorting order.
- var keys, sarray []string
- for k, _ := range params {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(params[k]))
- }
- joined := strings.Join(sarray, "&")
- payload := method + "\n" + host + "\n" + path + "\n" + joined
- hash := hmac.New(sha256.New, []byte(auth.SecretKey))
- hash.Write([]byte(payload))
- signature := make([]byte, b64.EncodedLen(hash.Size()))
- b64.Encode(signature, hash.Sum(nil))
-
- params["Signature"] = string(signature)
-}