Documentation ¶
Index ¶
- Constants
- func GenKey(rand io.Reader) (*PrivKey, *PubKey, error)
- func IsPointInfinity(x, y *big.Int) bool
- func MarshalEncryptedToASN1DER(in []byte) ([]byte, error)
- func UnmarshalEncryptedFromASN1DER(in []byte) ([]byte, error)
- type ASN1DERCipher
- type Curve
- type PrivKey
- func (sk *PrivKey) Decrypt(in []byte) ([]byte, error)
- func (sk *PrivKey) GenPubKey() *PubKey
- func (sk *PrivKey) Sign(userID []byte, data []byte) ([]byte, error)
- func (sk *PrivKey) SignToASN1DER(userID []byte, msg []byte) ([]byte, error)
- func (sk *PrivKey) SignToBigInt(userID []byte, msg []byte) (r, s *big.Int, err error)
- func (sk *PrivKey) String() string
- func (sk *PrivKey) ToBytes() []byte
- type PubKey
- func (pk *PubKey) Encrypt(msg []byte) ([]byte, error)
- func (pk *PubKey) String() string
- func (pk *PubKey) ToBytes() []byte
- func (pk *PubKey) ToUncompressedBytes() []byte
- func (pk *PubKey) Verify(userID []byte, data []byte, sig []byte) bool
- func (pk *PubKey) VerifyFromASN1DER(userID []byte, msg []byte, sigBytes []byte) bool
- func (pk *PubKey) VerifyFromBigInt(userID []byte, msg []byte, r, s *big.Int) bool
- type Signature
Constants ¶
View Source
const ( BitSize = 256 KeyBytes = (BitSize + 7) / 8 UnCompressed = 0x04 )
Variables ¶
This section is empty.
Functions ¶
func IsPointInfinity ¶
Types ¶
type ASN1DERCipher ¶
ASN1DERCipher 密文
type Curve ¶
Curve 曲线和曲线参数 3.1
func GetSm2P256 ¶
func GetSm2P256() Curve
func InitWithRecommendedParams ¶
func InitWithRecommendedParams() *Curve
InitWithRecommendedParams 使用推荐参数初始化曲线
type PrivKey ¶
PrivKey 私钥
func (*PrivKey) SignToASN1DER ¶
SignToASN1DER 生成签名并输出成 ASN.1 DER 格式
func (*PrivKey) SignToBigInt ¶
SignToBigInt 生成签名并输出成大数
type PubKey ¶
PubKey 公钥
func (*PubKey) ToUncompressedBytes ¶
ToUncompressedBytes 公钥未压缩字节流
func (*PubKey) VerifyFromASN1DER ¶
VerifyFromASN1DER 验证签名
Click to show internal directories.
Click to hide internal directories.