common

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameX         = "common"
	RAccountX     = "account"
	RTransactionX = "transaction"
)

consts

View Source
const (
	CharSet             = "UTF-8"
	Base64Format        = "UrlSafeNoPadding"
	RsaAlgorithmKeyType = "PKCS8"
	RsaAlgorithmSign    = crypto.SHA256
	// 定义支持的加密算法
	RsaCrypto = "rsa"
	Encrypt   = "encrypt"
	Template  = "template"
)

Variables

This section is empty.

Functions

func CreateKeys

func CreateKeys() (string, string)

生成密钥对

func DecodeString

func DecodeString(s string) ([]byte, error)

DecodeString returns the bytes represented by the base64 string s.

func EncodeToString

func EncodeToString(src []byte) string

EncodeToString returns the base64 encoding of src.

func MarshalPKCS8PrivateKey

func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte

func NewConvert

func NewConvert(title, symbol string, supports []string) db.ExecConvert

NewConvert create

func PrivateDecrypt

func PrivateDecrypt(privstr string, encrypted string) (string, error)

私钥解密

func PublicEncrypt

func PublicEncrypt(pubstr string, data string) (string, error)

通过公钥加密

Types

type XRsa

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

func NewXRsa

func NewXRsa(privateKey string, publicKey string) (*XRsa, error)

func (*XRsa) PrivateDecrypt

func (r *XRsa) PrivateDecrypt(encrypted string) (string, error)

私钥解密

func (*XRsa) PublicEncrypt

func (r *XRsa) PublicEncrypt(data string) (string, error)

公钥加密

func (*XRsa) Sign

func (r *XRsa) Sign(data string) (string, error)

数据加签

func (*XRsa) Verify

func (r *XRsa) Verify(data string, sign string) error

数据验签

Jump to

Keyboard shortcuts

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