Documentation
¶
Index ¶
- func Decryt(priv *PrivateKey, data []byte) ([]byte, error)
- func Encryt(rand io.Reader, pub *PublicKey, msg []byte) ([]byte, error)
- func MarshalSign(r, s *big.Int) ([]byte, error)
- func Sign(rand io.Reader, priv *PrivateKey, in, uid []byte) ([]byte, error)
- func SignDigest(rand io.Reader, priv *PrivateKey, digest []byte) ([]byte, error)
- func SignDigestRS(rand io.Reader, priv *PrivateKey, digest []byte) (r, s *big.Int, err error)
- func SignRS(rand io.Reader, priv *PrivateKey, in, userId []byte) (r, s *big.Int, err error)
- func UnmarshalSign(sig []byte) (r, s *big.Int, err error)
- func Verify(pub *PublicKey, in, uid, signature []byte) bool
- func VerifyDigest(pub *PublicKey, in, signature []byte) bool
- func VerifyDigestRS(pub *PublicKey, digest []byte, r, s *big.Int) bool
- func VerifyRS(pub *PublicKey, in []byte, uid []byte, r, s *big.Int) bool
- type P256V1Curve
- type PrivateKey
- func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool
- func (priv *PrivateKey) Public() crypto.PublicKey
- func (priv *PrivateKey) Sign(rand io.Reader, in, uid []byte) ([]byte, error)
- func (priv *PrivateKey) SignDigest(rand io.Reader, digest []byte) ([]byte, error)
- func (priv *PrivateKey) SignDigestRS(rand io.Reader, digest []byte) (r, s *big.Int, err error)
- func (priv *PrivateKey) SignRS(rand io.Reader, in []byte, uid []byte) (r, s *big.Int, err error)
- type PublicKey
- func (pub *PublicKey) Equal(x crypto.PublicKey) bool
- func (pub *PublicKey) SM3Digest(msg []byte, uid []byte) ([]byte, error)
- func (pub *PublicKey) Verify(in, uid, signature []byte) bool
- func (pub *PublicKey) VerifyDigest(in, signature []byte) bool
- func (pub *PublicKey) VerifyDigestRS(in []byte, r, s *big.Int) bool
- func (pub *PublicKey) VerifyRS(in, uid []byte, r, s *big.Int) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignDigest ¶ added in v1.0.1
摘要签名,返回DER编码的签名
func SignDigestRS ¶ added in v1.0.1
摘要签名,返回R||S
func VerifyDigest ¶ added in v1.0.1
func VerifyDigestRS ¶ added in v1.0.1
Types ¶
type P256V1Curve ¶
type P256V1Curve struct { *elliptic.CurveParams A *big.Int }
自定义SM2的椭圆曲线
func SM2P256V1 ¶ added in v1.0.2
func SM2P256V1() P256V1Curve
func (P256V1Curve) Params ¶
func (curve P256V1Curve) Params() *elliptic.CurveParams
type PrivateKey ¶
SM2 private key
func (*PrivateKey) Equal ¶
func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool
implement crypto.PrivateKey
func (*PrivateKey) Public ¶
func (priv *PrivateKey) Public() crypto.PublicKey
func (*PrivateKey) SignDigest ¶ added in v1.0.1
摘要签名,返回DER编码的签名
func (*PrivateKey) SignDigestRS ¶ added in v1.0.1
摘要签名,返回R||S
type PublicKey ¶
SM2 public key
func (*PublicKey) VerifyDigest ¶ added in v1.0.1
func (*PublicKey) VerifyDigestRS ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.