package
0.0.4
Repository: https://github.com/hxx258456/ccgo.git
Documentation: pkg.go.dev

# Functions

AdjustCiphertextSplicingOrder 修改sm2加密结果的C2C3拼接顺序 AdjustCiphertextSplicingOrder utility method to change c2 c3 order.
ASN1Ciphertext2Plain sm2加密结果去除ASN1转码 ASN1Ciphertext2Plain utility method to convert ASN.1 encoding ciphertext to plain encoding format.
CalculateZA ZA计算。 SM2签名与验签之前,先对签名内容做一次混入ZA的散列。 ZA的值是根据公钥与uid计算出来的。 CalculateZA ZA = H256(ENTLA || IDA || a || b || xG || yG || xA || yA).
goland:noinspection GoUnusedExportedFunction.
goland:noinspection GoUnusedExportedFunction.
Decrypt sm2私钥解密 opts传nil代表C1C3C2模式.
DecryptAsn1 sm2私钥解密, C1C3C2, C3C2做ASN1转码.
DecryptDefault sm2私钥解密, C1C3C2模式 goland:noinspection GoUnusedExportedFunction.
DefaultSM2SignerOption 生成一个默认的sm2签名参数.
Encrypt sm2公钥加密 opts传nil代表默认模式: C1C3C2, C1不压缩, C3C2不做ASN1转码.
EncryptAsn1 sm2公钥加密 默认模式: C1C3C2, C1不压缩, C3C2做ASN1转码.
EncryptDefault sm2公钥加密 默认模式: C1C3C2, C1不压缩, C3C2不做ASN1转码 goland:noinspection GoUnusedExportedFunction.
GenerateKey 生成sm2的公私钥对 GenerateKey generates a public and private key pair.
goland:noinspection GoUnusedExportedFunction.
IsSM2PublicKey check if given public key is a SM2 public key or not goland:noinspection GoUnusedExportedFunction.
NewPlainDecrypterOpts 生成不做ASN1转码的sm2解密参数.
NewPlainEncrypterOpts 生成不做ASN1转码的sm2加密参数.
NewSM2SignerOption 生成一个新的sm2签名参数 forceZA为true而uid为空时,使用defaultUID.
P256Sm2 获取sm2p256曲线 P256Sm2 init and return the singleton.
PlainCiphertext2ASN1 sm2加密结果改为ASN1转码 PlainCiphertext2ASN1 utility method to convert plain encoding ciphertext to ASN.1 encoding format.
ReadSm2PrivFromHex 将hex字符串转为sm2私钥 @param Dhex 16进制字符串,对应sm2.PrivateKey.D @return *PrivateKey sm2私钥 @return error.
ReadSm2PubFromHex 将hex字符串转为sm2公钥 @param Qhex sm2公钥座标x,y的字节数组拼接后的hex转码字符串 @return *PublicKey sm2公钥 @return error.
Sign Sign使用私钥priv对签名摘要hash进行签名,并将签名转为asn1格式字节数组。 会对hash做ZA混合散列。.
SignAfterZA sm2签名函数 1.内部不对签名内容hash进行混入ZA的散列处理。 2.内部会根据rand与hash使用aes生成一个后续签名生成随机数用的csprng,即本函数在签名时获取随机数时不是直接使用rand。.
SignASN1 SignASN1使用私钥priv对签名摘要hash进行签名,并将签名转为asn1格式字节数组。 会对hash做ZA混合散列。.
SignASN1WithOpts SignASN1使用私钥priv对签名摘要hash进行签名,并将签名转为asn1格式字节数组。 是否对hash做ZA混合散列取决于opts类型是否*sm2.SM2SignerOption且opts.ForceGMSign为true。 如果opts传nil,则对hash做ZA混合散列。 goland:noinspection GoUnusedExportedFunction.
SignWithZA 对msg做ZA混合散列后再对得到的校验和进行签名。 混合散列使用sm3 SignWithZA follow sm2 dsa standards for hash part, compliance with GB/T 32918.2-2016.
Sm2Sign Sm2Sign使用私钥priv对签名摘要hash进行签名,并将签名转为asn1格式字节数组。 会对hash做ZA混合散列。 goland:noinspection GoUnusedExportedFunction,GoNameStartsWithPackageName,GoUnusedParameter.
Sm2Verify sm2验签 对msg做ZA混合散列 goland:noinspection GoUnusedExportedFunction,GoNameStartsWithPackageName.
Verify sm2验签 对msg做ZA混合散列 goland:noinspection GoUnusedExportedFunction.
VerifyASN1 VerifyASN1将asn1格式字节数组的签名转为(r,s)在调用sm2的验签函数。 对msg做ZA混合散列.
VerifyASN1WithoutZA 将asn1格式字节数组的签名转为(r,s),再做验签。 不对hash再做ZA混合散列。 goland:noinspection GoUnusedExportedFunction.
VerifyWithZA 将对msg进行ZA混合散列后再进行验签。.
WriteSm2PrivToHex 将sm2私钥D转为hex字符串 @param key sm2私钥 @return string.
WriteSm2PubToHex 将sm2公钥转为hex字符串 @param key sm2公钥 @return string.

# Constants

No description provided by the author
C1C3C2 默认使用 C1C3C2.
ENCODING_ASN1 ASN1,即对C2C3做ASN1转码.
ENCODING_PLAIN 平文,即不对C2C3做ASN1转码.
MarshalCompressed C1压缩序列化 MarshalCompressed compressed mashal mode.
MarshalMixed C1混合序列化 MarshalMixed mixed mashal mode.
MarshalUncompressed C1不压缩序列化 MarshalUncompressed uncompressed mashal mode.

# Variables

ASN1DecrypterOpts ASN1转码解密参数: C1C3C2, C3C2做ASN1转码.
ASN1EncrypterOpts ASN1转码加密参数: C1C3C2, C1不压缩, C3C2做ASN1转码.

# Structs

DecrypterOpts 解密参数 DecrypterOpts decryption options.
EncrypterOpts 加密参数 EncrypterOpts encryption options.
PrivateKey SM2私钥结构体.
PublicKey SM2公钥结构体.
SM2SignerOption sm2签名参数 SM2SignerOption implements crypto.SignerOpts interface.

# Interfaces

Signer SM2 special signer.