Documentation ¶
Index ¶
- Constants
- func AuthHeaderValue(signature, accessKey, credentialScope, signedHeaders string) string
- func CanonicalHeaders(r *http.Request, signedHeaders map[string]bool) string
- func CanonicalQueryString(r *http.Request) string
- func CanonicalRequest(r *http.Request, signedHeaders map[string]bool) (string, error)
- func CanonicalURI(r *http.Request) string
- func CredentialScope(t time.Time, regionName, serviceName string) string
- func GenerateSigningKey(secretKey, regionName, serviceName string, t time.Time) ([]byte, error)
- func HexEncodeSHA256Hash(body []byte) (string, error)
- func RequestPayload(r *http.Request) ([]byte, error)
- func SignStringToSign(stringToSign string, signingKey []byte) (string, error)
- func SignedHeaders(r *http.Request, signedHeaders map[string]bool) string
- func StringToSign(canonicalRequest, credentialScope string, t time.Time) string
- type Signature
Constants ¶
const ( BasicDateFormat = "20060102T150405Z" BasicDateFormatShort = "20060102" )
BasicDateFormat and BasicDateFormatShort define aws-date format
Variables ¶
This section is empty.
Functions ¶
func AuthHeaderValue ¶
Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign
func CanonicalHeaders ¶
CanonicalHeaders
func CanonicalRequest ¶
Build a CanonicalRequest from a regular request string
See http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html CanonicalRequest =
HTTPRequestMethod + '\n' + CanonicalURI + '\n' + CanonicalQueryString + '\n' + CanonicalHeaders + '\n' + SignedHeaders + '\n' + HexEncode(Hash(RequestPayload))
func CredentialScope ¶
Return the Credential Scope. See http://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
func GenerateSigningKey ¶
Generate a "signing key" to sign the "String To Sign". See http://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html
func HexEncodeSHA256Hash ¶
HexEncodeSHA256Hash return hexcode of sha256
func SignStringToSign ¶
Create the AWS Signature Version 4. See http://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html
func SignedHeaders ¶
SignedHeaders
func StringToSign ¶
Create a "String to Sign". See http://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
Types ¶
type Signature ¶
Signature AWS meta
func GetSignature ¶
Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc Authorization: AWS4-HMAC-SHA256 Credential=devops/20180312/hz/dnsapi/aws4_request,SignedHeaders=Content-Length;Content-type;host;x-amz-date,Signature=8a31f6aaa5026579bb2cf20962768190fdd0b4846ed5c48842fa61936245e9c5