Documentation ¶
Overview ¶
Package btcutil Utility functions for Bitcoin elliptic curve cryptography.
Index ¶
- func Add(a, b *ecdsa.PublicKey) *ecdsa.PublicKey
- func BlindMessage(rState *BlindRequesterState, Q, R *ecdsa.PublicKey, m *big.Int) *big.Int
- func BlindSession(sState *BlindSignerState) (*ecdsa.PublicKey, *ecdsa.PublicKey)
- func BlindSign(sState *BlindSignerState, R *ecdsa.PublicKey, mHat *big.Int) *big.Int
- func BlindVerify(Q *ecdsa.PublicKey, sig *BlindSignature) bool
- func ECDH(priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey) *big.Int
- func GenerateKey(rand io.Reader) (*ecdsa.PrivateKey, error)
- func KeysEqual(a, b *ecdsa.PublicKey) bool
- func RandFieldElement(rand io.Reader) (k *big.Int, err error)
- func ScalarBaseMult(k *big.Int) *ecdsa.PublicKey
- func ScalarMult(k *big.Int, B *ecdsa.PublicKey) *ecdsa.PublicKey
- func Secp256k1() elliptic.Curve
- type BlindRequesterState
- type BlindSignature
- type BlindSignerState
- type KoblitzCurve
- func (curve *KoblitzCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool
- func (curve *KoblitzCurve) Params() *elliptic.CurveParams
- func (curve *KoblitzCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlindMessage ¶
BlindMessage Calculates a blinded version of message m
func BlindSession ¶
func BlindSession(sState *BlindSignerState) (*ecdsa.PublicKey, *ecdsa.PublicKey)
BlindSession Request that the signer start a blind signature protocol. Returns the signer's public key and an EC point named R.
func BlindVerify ¶
func BlindVerify(Q *ecdsa.PublicKey, sig *BlindSignature) bool
BlindVerify 不清楚干嘛的
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*ecdsa.PrivateKey, error)
GenerateKey generates a public and private key pair
func RandFieldElement ¶
RandFieldElement returns a random element of the field underlying the given curve using the procedure given in [NSA] A.2.1.
Implementation copied from Go's crypto/ecdsa package since the function wasn't public. Modified to always use secp256k1 curve.
func ScalarBaseMult ¶
ScalarBaseMult Multiplies the base G by a large integer. The resulting point is represented as an ECDSA public key since that's typically how they're used.
func ScalarMult ¶
ScalarMult Multiply a large integer and a point. The resulting point is represented as an ECDSA public key.
Types ¶
type BlindRequesterState ¶
type BlindRequesterState struct { // shareable stuff F *ecdsa.PublicKey X0 *big.Int // Mhat *big.Int // called m̂ in the paper // contains filtered or unexported fields }
BlindRequesterState State
type BlindSignature ¶
BlindSignature Based on algorithm described in An Efficient Blind Signature Scheme Based on the Elliptic Curve Discrete Logarithm Problem by Nikooghadam and Zakerolhosseini
func BlindExtract ¶
func BlindExtract(rState *BlindRequesterState, sHat *big.Int) *BlindSignature
BlindExtract Extract true signature from the blind signature
type BlindSignerState ¶
type BlindSignerState struct { // shareable stuff Q *ecdsa.PublicKey // contains filtered or unexported fields }
BlindSignerState blind signer state
type KoblitzCurve ¶
type KoblitzCurve struct { P *big.Int // the order of the underlying field N *big.Int // the order of the base point B *big.Int // the constant of the KoblitzCurve equation Gx, Gy *big.Int // (x,y) of the base point BitSize int // the size of the underlying field }
KoblitzCurve A Koblitz Curve with a=0.
func (*KoblitzCurve) IsOnCurve ¶
func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool
IsOnCurve check is on curve
func (*KoblitzCurve) Params ¶
func (curve *KoblitzCurve) Params() *elliptic.CurveParams
Params 获取参数列表
func (*KoblitzCurve) ScalarBaseMult ¶
ScalarBaseMult multiple
func (*KoblitzCurve) ScalarMult ¶
ScalarMult scalar multiple