cfcasm2go

package module
v0.0.0-...-2dc8d6e Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 7 Imported by: 0

README

cfcasm2go

CFCA SM2证书签名工具Golang版。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerDecode

func DerDecode(der []byte) [2]*big.Int

DerDecode DER解码

func DerEncode

func DerEncode(R, S big.Int) []byte

DerEncode DER编码

M2签名值的DER编码格式: 0x30 + 数据总长度 + 0x02 + R的长度 + R + 0x02 + S的长度 + S

func GenSM2PrivateKey

func GenSM2PrivateKey(hexD, hexX, hexY string) (sm2.PrivateKey, error)

GenSM2PrivateKey 根据提供的公钥十六进制编码X Y, 私钥十六进制编码D,生成SM2私钥

hexD 私钥D的十六进制编码

hexX 公钥X的十六进制编码

hexY 公钥Y的十六进制编码

func GenSM2PublicKey

func GenSM2PublicKey(hexX, hexY string) (sm2.PublicKey, error)

GenSM2PublicKey 根据提供的公钥十六进制编码X|Y生成SM2公钥

hexX 公钥X的十六进制编码

hexY 公钥Y的十六进制编码

func SM2Sign

func SM2Sign(priKey *sm2.PrivateKey, data, uid []byte) (string, error)

SM2Sign SM2私钥加签,返回Base64格式编码

priKey SM2 私钥

data 需要加密的数据

uid UID

func SM2Verify

func SM2Verify(pubKey *sm2.PublicKey, data, uid, sign []byte) bool

SM2Verify SM2公钥验签

pubKey SM2公钥

data 原始数据

uid UID

sign 签名串

Types

This section is empty.

Jump to

Keyboard shortcuts

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