utils

package
v0.0.0-...-8644ddb Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppId      = ""
	GatewayUrl = ""
	APIVersion = ""
)

Variables

View Source
var EncryptionFailed error = errors.New("encryption failed")

Functions

func BuildQuery

func BuildQuery(params map[string]string) string

func DecryptBase64

func DecryptBase64(data string) []byte

DecryptBase64 decrypt given string with Base64 algorithm

func DecryptRSA

func DecryptRSA(data []byte) []byte

DecryptRSA decrypt given []byte with RSA algorithm

func Encrypt

func Encrypt(query string) (string, error)

func EncryptBase64

func EncryptBase64(data []byte) string

EncryptBase64 encrypt given []byte with Base64 algorithm

func EncryptMD5

func EncryptMD5(data []byte) []byte

EncryptMD5 encrypt given []byte with MD5 algorithm

func EncryptRSA

func EncryptRSA(data []byte) []byte

EncryptRSA encrypt given data with RSA algorithm

func EncryptSHA

func EncryptSHA(data []byte) []byte

EncryptSHA encrypt given []byte with SHA algorithm

func EncrytQuery

func EncrytQuery(query string, appId string) (string, error)

func HttpPost

func HttpPost(client *http.Client, url string, content string, charset string) (string, error)

func Sign

func Sign(query string) string

func SignRSA

func SignRSA(raw []byte, algorithm crypto.Hash) []byte

SignWithRSA sign given encrypted data with RSA algorithm

func VerifySignature

func VerifySignature(raw []byte, signature string, algorithm crypto.Hash) bool

VerifySignature verify whether the given signature is correct

Types

This section is empty.

Jump to

Keyboard shortcuts

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