sign

package
v0.0.0-...-05508b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-3.

This implementation derives the nonce from an AES-CTR CSPRNG keyed by ChopMD(256, SHA2-512(priv.D || entropy || hash)). The CSPRNG key is IRO by a result of Coron; the AES-CTR stream is IRO under standard assumptions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyBySeed

func GenerateKeyBySeed(c elliptic.Curve, seed []byte) (*ecdsa.PrivateKey, error)

GenerateKey generates a public and private key pair.

func MarshalECDSASignature

func MarshalECDSASignature(r, s *big.Int) ([]byte, error)

use DER-encoded ASN.1 octet standard to represent the signature 与比特币算法一样,基于DER-encoded ASN.1 octet标准,来表达使用椭圆曲线签名算法返回的结果

func MarshalPublicKey

func MarshalPublicKey(publicKey *ecdsa.PublicKey) []byte

将公钥序列化成byte数组

func SignECDSA

func SignECDSA(k *ecdsa.PrivateKey, msg []byte) (signature []byte, err error)

func SignV2ECDSA

func SignV2ECDSA(k *ecdsa.PrivateKey, msg []byte) (signature []byte, err error)

func UnmarshalECDSASignature

func UnmarshalECDSASignature(rawSig []byte) (*big.Int, *big.Int, error)

func VerifyECDSA

func VerifyECDSA(k *ecdsa.PublicKey, sig, msg []byte) (valid bool, err error)

func VerifyV2ECDSA

func VerifyV2ECDSA(k *ecdsa.PublicKey, sig, msg []byte) (valid bool, err error)

Types

type ECDSASignature

type ECDSASignature struct {
	R, S *big.Int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL