Documentation ¶
Overview ¶
Package sm2 带证书交易的签名
Index ¶
- Constants
- Variables
- func Deserialize(sigStr []byte) (*big.Int, *big.Int, error)
- func New(sub []byte)
- func NewGmValidator() core.Validator
- func Serialize(r, s *big.Int) []byte
- func SerializePrivateKey(p *sm2.PrivateKey) []byte
- func SerializePublicKey(p *sm2.PublicKey, isCompress bool) []byte
- type Driver
- func (d Driver) GenKey() (crypto.PrivKey, error)
- func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)
- func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)
- func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)
- func (d Driver) Validate(msg, pub, sig []byte) error
- type PrivKeySM2
- type PubKeySM2
- type SignatureS
- type SignatureSM2
Constants ¶
View Source
const ( SM2PrivateKeyLength = 32 SM2PublicKeyLength = 65 SM2PublicKeyCompressed = 33 SM2SignatureMinLength = 72 )
const
View Source
const ( Name = "sm2" ID = 258 )
const
Variables ¶
View Source
var SM2Author = authority.Authority{}
SM2Author sm2证书校验
Functions ¶
func NewGmValidator ¶ added in v1.65.3
NewGmValidator 创建国密证书校验器
func SerializePrivateKey ¶
func SerializePrivateKey(p *sm2.PrivateKey) []byte
SerializePrivateKey 私钥序列化
Types ¶
type Driver ¶
type Driver struct{}
Driver 驱动
func (Driver) PrivKeyFromBytes ¶
PrivKeyFromBytes 字节转为私钥
func (Driver) PubKeyFromBytes ¶
PubKeyFromBytes 字节转为公钥
func (Driver) SignatureFromBytes ¶
SignatureFromBytes 字节转为签名
type PrivKeySM2 ¶
type PrivKeySM2 [SM2PrivateKeyLength]byte
PrivKeySM2 私钥
func (PrivKeySM2) String ¶
func (privKey PrivKeySM2) String() string
type PubKeySM2 ¶
type PubKeySM2 [SM2PublicKeyLength]byte
PubKeySM2 公钥
type SignatureS ¶
SignatureS 签名
type SignatureSM2 ¶
type SignatureSM2 []byte
SignatureSM2 签名
func (SignatureSM2) String ¶
func (sig SignatureSM2) String() string
Click to show internal directories.
Click to hide internal directories.