Versions in this module Expand all Collapse all v1 v1.0.0 Jun 11, 2019 Changes in this version + const BitSize + const KeyBytes + const UnCompress + func BHGenerateKey() (pubKey string, priKey string, err error) + func BHGeneratePointCompressKey() (pubKey string, priKey string, err error) + func BHSign(priKey string, userID []byte, src []byte) ([]byte, error) + func BHSignX(priKey string, userID []byte, src []byte) ([]byte, error) + func BHVerify(pubKey string, userID []byte, src []byte, sign []byte) (pass bool, err error) + func BHVerifyWithPointCompress(pubKey string, userID []byte, src []byte, sign []byte) (pass bool, err error) + func BHVerifyWithPointCompressX(pubKey string, userID []byte, src []byte, sign []byte) (pass bool, err error) + func BHVerifyX(pubKey string, userID []byte, src []byte, sign []byte) (pass bool, err error) + func Decrypt(priv *PrivateKey, in []byte) ([]byte, error) + func Encrypt(pub *PublicKey, in []byte) ([]byte, error) + func GenerateKey(rand io.Reader) (*PrivateKey, *PublicKey, error) + func MarshalCipher(in []byte) ([]byte, error) + func MarshalSign(r, s *big.Int) ([]byte, error) + func P256Sm2() elliptic.Curve + func ResponderConfirm(responderS2 []byte, initiatorS2 []byte) bool + func Sign(priv *PrivateKey, userId []byte, in []byte) ([]byte, error) + func SignToRS(priv *PrivateKey, userId []byte, in []byte) (r, s *big.Int, err error) + func UnmarshalCipher(in []byte) (out []byte, err error) + func UnmarshalSign(sign []byte) (r, s *big.Int, err error) + func Verify(pub *PublicKey, userId []byte, src []byte, sign []byte) bool + func VerifyByRS(pub *PublicKey, userId []byte, src []byte, r, s *big.Int) bool + type ExchangeResult struct + Key []byte + S1 []byte + S2 []byte + func CalculateKeyWithConfirmation(initiator bool, keyBits int, confirmationTag []byte, ...) (*ExchangeResult, error) + type P256V1Curve struct + A *big.Int + func GetSm2P256V1() P256V1Curve + type PrivateKey struct + Curve P256V1Curve + D *big.Int + func RawBytesToPrivateKey(bytes []byte) (*PrivateKey, error) + func (pri *PrivateKey) GetRawBytes() []byte + type PublicKey struct + Curve P256V1Curve + X *big.Int + Y *big.Int + func RawBytesToPublicKey(bytes []byte) (*PublicKey, error) + func (pub *PublicKey) GetRawBytes() []byte + func (pub *PublicKey) GetUnCompressBytes() []byte