sm2

package
v1.0.1006 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSM2InvalidKey     = errors.New("key is invalid")
	ErrSM2InvalidKeyType = errors.New("key is of invalid type")
	ErrSM2Verification   = errors.New("sm2: verification error")
)
View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
)

Functions

func ParseSM2PrivateKeyFromPEM

func ParseSM2PrivateKeyFromPEM(key []byte) (*sm2.PrivateKey, error)

解析 SM2 PKCS8 私钥

func ParseSM2PrivateKeyFromPEMWithPassword

func ParseSM2PrivateKeyFromPEMWithPassword(key []byte, password string) (*sm2.PrivateKey, error)

解析 SM2 PKCS8 私钥带密码

func ParseSM2PublicKeyFromPEM

func ParseSM2PublicKeyFromPEM(key []byte) (*sm2.PublicKey, error)

解析 SM2 PKCS8 公钥

Types

type SigningMethodSM2

type SigningMethodSM2 struct{}

*

  • 国密 SM2 签名验证 *
  • @create 2022-4-16
  • @author deatil
var (
	SigningMethodGmSM2 *SigningMethodSM2
)

func (*SigningMethodSM2) Alg

func (this *SigningMethodSM2) Alg() string

标识

func (*SigningMethodSM2) Sign

func (this *SigningMethodSM2) Sign(signingString string, key any) (string, error)

私钥签名

func (*SigningMethodSM2) Verify

func (this *SigningMethodSM2) Verify(signingString, signature string, key any) error

公钥验证

Jump to

Keyboard shortcuts

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