encoding

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJwtPrivateKey

func GetJwtPrivateKey() *ecdsa.PrivateKey

func GetJwtPrivateKeyContent

func GetJwtPrivateKeyContent() string

func GetJwtPublicKey

func GetJwtPublicKey() *ecdsa.PublicKey

func GetJwtPublicKeyContent

func GetJwtPublicKeyContent() string

func GetRsaPrivateKey

func GetRsaPrivateKey() *rsa.PrivateKey

func GetRsaPrivateKeyContent

func GetRsaPrivateKeyContent() string

func GetRsaPublicKey

func GetRsaPublicKey() *rsa.PublicKey

func GetRsaPublicKeyContent

func GetRsaPublicKeyContent() string

func InitEncodingKeys

func InitEncodingKeys()

func ReInitEncodingKeys

func ReInitEncodingKeys()

func RsaDecrypt

func RsaDecrypt(plain string) (string, error)

func RsaEncrypt

func RsaEncrypt(plain string) (string, error)

func Sha256Encrypt

func Sha256Encrypt(plain string) string

func SignJwt

func SignJwt(ctx context.Context, m map[string]any) (string, error)

SignJwt 生成jwt

func UnpackJwt

func UnpackJwt(content string) (map[string]any, error)

UnpackJwt 解开jwt token内容

func VerifyJwt

func VerifyJwt(content string) (bool, error)

VerifyJwt 校验jwt

Types

type JwtConfig

type JwtConfig struct {
	sync.RWMutex
	PrivateKeyContent string `json:"privateKey" v:"required" dc:"私钥"`
	PublicKeyContent  string `json:"publicKey" v:"required" dc:"公钥"`
}

type JwtKeys

type JwtKeys struct {
	sync.RWMutex
	PrivateKey *ecdsa.PrivateKey
	PublicKey  *ecdsa.PublicKey
}

type RsaConfig

type RsaConfig struct {
	sync.RWMutex
	PrivateKey string `json:"privateKey" v:"required" dc:"私钥"`
	PublicKey  string `json:"publicKey" v:"required" dc:"公钥"`
}

type RsaKeys

type RsaKeys struct {
	sync.RWMutex
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

Jump to

Keyboard shortcuts

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