sign

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SIGN_TYPE_MD5             = "MD5"
	SIGN_TYPE_SHA256_WITH_RSA = "RSA"
)

Variables

This section is empty.

Functions

func CheckSign

func CheckSign(charset string, source string, signMsg string, config model.MerchantConfig, signType string) (err error)

func GbkToUtf8

func GbkToUtf8(s []byte) ([]byte, error)

func GenerateMd5Key

func GenerateMd5Key(length int) string

func GenerateMd5KeyWith32Word

func GenerateMd5KeyWith32Word() string

func GenerateSign

func GenerateSign(charset string, source string, config model.MerchantConfig, signType string) (sign string, err error)

func ParsePrivateKey

func ParsePrivateKey(raw string) (result []byte)

func ParsePublicKey

func ParsePublicKey(raw string) (result []byte)

func RSADecrypt

func RSADecrypt(ciphertext, key []byte) ([]byte, error)

func RSAEncrypt

func RSAEncrypt(plaintext, key []byte) ([]byte, error)

func SignPKCS1v15

func SignPKCS1v15(src, privateKey []byte, hash crypto.Hash) ([]byte, error)

func SignPKCS1v15WithStringKey

func SignPKCS1v15WithStringKey(src []byte, privateKeyString string, hash crypto.Hash) ([]byte, error)

func SignPKCS8

func SignPKCS8(src []byte, privateKey string, hash crypto.Hash) ([]byte, error)

func Utf8ToGbk

func Utf8ToGbk(s []byte) ([]byte, error)

func VerifyPKCS1v15

func VerifyPKCS1v15(src, sig, publicKey []byte, hash crypto.Hash) error

func VerifyPKCS1v15WithStringKey

func VerifyPKCS1v15WithStringKey(src, sig []byte, publicKeyString string, hash crypto.Hash) error

Types

type CheckSignInterface

type CheckSignInterface interface {
	// contains filtered or unexported methods
}

type CheckSignValidator

type CheckSignValidator struct {
	// contains filtered or unexported fields
}

func NewCheckSignValidator

func NewCheckSignValidator() *CheckSignValidator

func (*CheckSignValidator) Validate

func (validator *CheckSignValidator) Validate(request pay.PayRequest, cfg service.GatewayConfig) (e error)

type Md5

type Md5 struct {
}

type ParamsCompacter

type ParamsCompacter struct {
	IgnoreKeys       []string
	IgnoreEmptyValue bool

	SortedKeyFieldNames []string
	PairsDelimiter      string
	KeyValueDelimiter   string
	FieldTag            string
	// contains filtered or unexported fields
}

func NewParamsCompacter

func NewParamsCompacter(entityDemoInstance interface{}, fieldTag string, ignoreKeys []string, ignoreEmptyValue bool, pairsDelimiter string, keyValueDelimiter string) ParamsCompacter

func (ParamsCompacter) BuildMapToString

func (p ParamsCompacter) BuildMapToString(params map[string]string) string

func (ParamsCompacter) ParamsToString

func (p ParamsCompacter) ParamsToString(instance interface{}) string

type RsaGenerator

type RsaGenerator struct {
	// contains filtered or unexported fields
}

func NewRsa2048Generator

func NewRsa2048Generator() (*RsaGenerator, error)

func NewRsa3072Generator

func NewRsa3072Generator() (*RsaGenerator, error)

func NewRsa4096Generator

func NewRsa4096Generator() (*RsaGenerator, error)

func NewRsaGenerator

func NewRsaGenerator(bitSize int) (*RsaGenerator, error)

func (*RsaGenerator) GenerateBase64KeyOfPrivateKey

func (g *RsaGenerator) GenerateBase64KeyOfPrivateKey() (string, error)

func (*RsaGenerator) GenerateKeyOfPrivateKey

func (g *RsaGenerator) GenerateKeyOfPrivateKey() ([]byte, error)

func (*RsaGenerator) GeneratePemPrivateKey

func (g *RsaGenerator) GeneratePemPrivateKey() (string, error)

func (*RsaGenerator) GeneratePemPrivatePKCS1Key

func (g *RsaGenerator) GeneratePemPrivatePKCS1Key() (string, error)

func (*RsaGenerator) GeneratePemPublicKey

func (g *RsaGenerator) GeneratePemPublicKey() (string, error)

func (*RsaGenerator) GeneratePemPublicPKIXKey

func (g *RsaGenerator) GeneratePemPublicPKIXKey() (string, error)

type Sha256WithRSA

type Sha256WithRSA struct {
}

Jump to

Keyboard shortcuts

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