sign

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeJSON       = "application/json"
	MimeXML        = "application/xml"
	MimeUrlencoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func ECDSASign

func ECDSASign(priv string, payload string) (hash string, err error)

func ECDSAVerify

func ECDSAVerify(pub1 string, pub2 string, payload string, sig string) bool

func GenerateECDSAKeyPair

func GenerateECDSAKeyPair() (pub1, pub2, private string, err error)

func GetPayloadFromHTTPRequest

func GetPayloadFromHTTPRequest(r *http.Request) (string, error)

func GetSignFromHTTPRequest

func GetSignFromHTTPRequest(r *http.Request, key, secret, private string, algorithm AuthAlgorithm) (string, error)

func SumSha1Hmac

func SumSha1Hmac(secret, payload string) string

func SumSha256Hmac

func SumSha256Hmac(secret string, payload ...string) string

func SumSha512Hmac

func SumSha512Hmac(secret string, payload ...string) string

func Verify

func Verify(key, secret, private string, algorithm AuthAlgorithm, signStr, payload string) bool

Types

type AuthAlgorithm

type AuthAlgorithm string
const (
	HmacSha1   AuthAlgorithm = "HMAC-SHA1"
	HmacSha256 AuthAlgorithm = "HMAC-SHA256"
	HmacSha512 AuthAlgorithm = "HMAC-SHA512"
	ECDSA      AuthAlgorithm = "ECDSA"
)

Jump to

Keyboard shortcuts

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