signature

package
v0.0.0-...-21047fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2020 License: GPL-2.0 Imports: 10 Imported by: 2

README

Creating the Signature

  1. Every URL must supply:
  • public_key
  • timestamp with timezone (strictly RFC33339 format)
  • signature (computed below)
  1. Create the canonicalized query string that you need later in this procedure:
  • Sort the query string components by parameter name with natural byte ordering.
  • URL encode the parameter name and values according to the following rules:
  • Do not URL encode any of the unreserved characters that RFC 3986 defines.
  • These unreserved characters are A-Z, a-z, 0-9, hyphen ( - ), underscore ( _ ), period ( . ), and tilde ( ~ ).
  • Percent encode all other characters with %XY, where X and Y are hex characters 0-9 and uppercase A-F.
  • Percent encode the space character as %20 (and not +, as common encoding schemes do).
  • Separate the encoded parameter names from their encoded values with the equals sign ( = )
  • Separate the name-value pairs with an ampersand ( & )
  1. Create the string to sign according to the pseudo-grammar shown below (the "\n" represents an ASCII newline character).
StringToSign = HTTPRequestPath + "\n" + CanonicalizedQueryString <from the preceding step>
  1. Calculate an RFC 2104-compliant HMAC with the string you just created, your Secret Access Key as the key, and SHA512 as the hash algorithm.

  2. Convert the resulting value to base64

  3. Use the resulting value as the value of the signature request parameter.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSecretKey

func GetSecretKey(publicKey string) string

func IsRequestValid

func IsRequestValid(
	public_key, private_key, timestamp, signature string, expiry int64, path string,
) error

func MakeSignature

func MakeSignature(public_key, secret_key, timestamp string, expiry int64, path string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL