Documentation
¶
Index ¶
- type SM2
- func NewSM2() SM2
- func SM2FromBase64String(data string) SM2
- func SM2FromBytes(data []byte) SM2
- func SM2FromHexString(data string) SM2
- func SM2FromPrivateKey(key []byte) SM2
- func SM2FromPrivateKeyWithPassword(key []byte, password string) SM2
- func SM2FromPublicKey(key []byte) SM2
- func SM2FromString(data string) SM2
- func SM2GenerateKey() SM2
- func (this SM2) CreatePrivateKey() SM2
- func (this SM2) CreatePrivateKeyWithPassword(password string) SM2
- func (this SM2) CreatePublicKey() SM2
- func (this SM2) Decrypt() SM2
- func (this SM2) Encrypt() SM2
- func (this SM2) FromBase64String(data string) SM2
- func (this SM2) FromBytes(data []byte) SM2
- func (this SM2) FromHexString(data string) SM2
- func (this SM2) FromPrivateKey(key []byte) SM2
- func (this SM2) FromPrivateKeyBytes(priByte []byte) SM2
- func (this SM2) FromPrivateKeyDBytes(DBytes []byte) SM2
- func (this SM2) FromPrivateKeyString(keyString string) SM2
- func (this SM2) FromPrivateKeyWithPassword(key []byte, password string) SM2
- func (this SM2) FromPublicKey(key []byte) SM2
- func (this SM2) FromPublicKeyString(keyString string) SM2
- func (this SM2) FromPublicKeyXYBytes(XBytes, YBytes []byte) SM2
- func (this SM2) FromString(data string) SM2
- func (this SM2) GenerateKey() SM2
- func (this SM2) GetData() []byte
- func (this SM2) GetError() error
- func (this SM2) GetKeyData() []byte
- func (this SM2) GetParedData() []byte
- func (this SM2) GetPrivateKey() *sm2.PrivateKey
- func (this SM2) GetPrivateKeyCurve() elliptic.Curve
- func (this SM2) GetPrivateKeyD() *big.Int
- func (this SM2) GetPrivateKeyX() *big.Int
- func (this SM2) GetPrivateKeyY() *big.Int
- func (this SM2) GetPublicKey() *sm2.PublicKey
- func (this SM2) GetPublicKeyCurve() elliptic.Curve
- func (this SM2) GetPublicKeyX() *big.Int
- func (this SM2) GetPublicKeyY() *big.Int
- func (this SM2) GetVeryed() bool
- func (this SM2) MakePublicKey() SM2
- func (this SM2) OnError(fn SM2ErrorFunc) SM2
- func (this SM2) ParsePrivateKeyFromPEM(key []byte) (*sm2.PrivateKey, error)
- func (this SM2) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (*sm2.PrivateKey, error)
- func (this SM2) ParsePublicKeyFromPEM(key []byte) (*sm2.PublicKey, error)
- func (this SM2) Sign() SM2
- func (this SM2) SignAsn1(uid []byte) SM2
- func (this SM2) SignHex(uid []byte) SM2
- func (this SM2) ToBase64String() string
- func (this SM2) ToBytes() []byte
- func (this SM2) ToHexString() string
- func (this SM2) ToKeyBytes() []byte
- func (this SM2) ToKeyString() string
- func (this SM2) ToString() string
- func (this SM2) ToVeryed() bool
- func (this SM2) VerifyAsn1(data []byte, uid []byte) SM2
- func (this SM2) VerifyHex(data []byte, uid []byte) SM2
- func (this SM2) Very(data []byte) SM2
- func (this SM2) WithData(data []byte) SM2
- func (this SM2) WithError(err error) SM2
- func (this SM2) WithParedData(data []byte) SM2
- func (this SM2) WithPrivateKey(data *sm2.PrivateKey) SM2
- func (this SM2) WithPublicKey(data *sm2.PublicKey) SM2
- func (this SM2) WithVeryed(data bool) SM2
- type SM2ErrorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SM2 ¶
type SM2 struct {
// 错误
Error error
// contains filtered or unexported fields
}
*
- 国密 SM2 加密 *
- @create 2022-4-16
- @author deatil
func SM2FromPrivateKeyWithPassword ¶
私钥带密码
func (SM2) CreatePrivateKeyWithPassword ¶
国密私钥带密码
func (SM2) FromPrivateKeyBytes ¶
明文私钥生成私钥结构体
func (SM2) FromPrivateKeyDBytes ¶
私钥字符,必须先添加公钥
func (SM2) FromPrivateKeyString ¶
私钥字符,必须先添加公钥 (hexStringD) private-key: 07e4********;
func (SM2) FromPrivateKeyWithPassword ¶
私钥带密码
func (SM2) FromPublicKeyString ¶
公钥字符 (hexStringX + hexStringY) public-key: 047c********.
func (SM2) FromPublicKeyXYBytes ¶
公钥字符对
func (SM2) GetPrivateKeyCurve ¶
获取 PrivateKeyCurve
func (SM2) GetPrivateKeyD ¶
获取 PrivateKeyD privateKeyDHex := cryptobin_tool.NewEncoding().HexEncode(GetPrivateKeyD().Bytes())
func (SM2) GetPrivateKeyX ¶
获取 PrivateKeyX privateKeyXHex := cryptobin_tool.NewEncoding().HexEncode(GetPrivateKeyX().Bytes())
func (SM2) GetPrivateKeyY ¶
获取 PrivateKeyY privateKeyYHex := cryptobin_tool.NewEncoding().HexEncode(GetPrivateKeyY().Bytes())
func (SM2) GetPublicKeyX ¶
获取 PublicKeyX publicKeyXHex := cryptobin_tool.NewEncoding().HexEncode(GetPublicKeyX().Bytes())
func (SM2) GetPublicKeyY ¶
获取 PublicKeyY publicKeyYHex := cryptobin_tool.NewEncoding().HexEncode(GetPublicKeyY().Bytes())
func (SM2) ParsePrivateKeyFromPEM ¶
func (this SM2) ParsePrivateKeyFromPEM(key []byte) (*sm2.PrivateKey, error)
解析 SM2 PKCS8 私钥
func (SM2) ParsePrivateKeyFromPEMWithPassword ¶
func (this SM2) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (*sm2.PrivateKey, error)
解析 SM2 PKCS8 私钥带密码
func (SM2) ParsePublicKeyFromPEM ¶
解析 SM2 PKCS8 公钥
func (SM2) VerifyAsn1 ¶
公钥验证 使用原始数据[data]对比签名后数据