Documentation ¶
Index ¶
- Constants
- func AuthHeaderValue(signature, accessKey, credentialScope, signedHeaders string) string
- func CanonicalHeaders(r *http.Request) string
- func CanonicalQueryString(r *http.Request) string
- func CanonicalRequest(r *http.Request) (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) string
- func StringToSign(canonicalRequest, credentialScope string, t time.Time) string
- type Signer
Constants ¶
const ( BasicDateFormat = "20060102T150405Z" BasicDateFormatShort = "20060102" TerminationString = "sdk_request" Algorithm = "SDK-HMAC-SHA256" PreSKString = "SDK" HeaderXDate = "x-sdk-date" HeaderDate = "date" HeaderHost = "host" HeaderAuthorization = "Authorization" )
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 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 returns hexcode of sha256
func SignStringToSign ¶
Create the HWS Signature. See http://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html
func StringToSign ¶
Create a "String to Sign". See http://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html