24 lines
960 B
Go
24 lines
960 B
Go
package sm2
|
|
|
|
import "xdx.jelly/xgcl/gerrors"
|
|
|
|
//go:generate stringer -type=ErrorCode -linecomment -output=errors_string.go errors.go
|
|
type ErrorCode gerrors.ErrorCode
|
|
|
|
func (e ErrorCode) Error() string {
|
|
return gerrors.Format(uint32(e), e.String())
|
|
}
|
|
|
|
// error codes
|
|
const (
|
|
ErrInvalidInput ErrorCode = 0x01002000 + iota //输入不合法
|
|
ErrInvalidCurve //不是SM2曲线
|
|
ErrInvalidPoint //不是SM2曲线上的点
|
|
ErrDecodeASN1Failed //ASN.1解码失败
|
|
ErrInvalidPublicKey //SM2公钥不合法
|
|
ErrEncFailed //SM2加密失败
|
|
ErrDecFailed //SM2解密失败
|
|
ErrKeyExchangeFailed //SM2密钥交换失败
|
|
ErrRandomError //输入随机数不合适,重新产生随机数
|
|
)
|