Documentation ¶
Index ¶
- Constants
- Variables
- func GetEC(curveType int32) (elliptic.Curve, error)
- func Secp256k1() elliptic.Curve
- type KeyDerivation
- func (kd *KeyDerivation) FromKDMessage(msg *protos.KeyDerived)
- func (kd *KeyDerivation) GenIntermediary(pub *ecdsa.PublicKey, index *big.Int) ([]byte, *KeyDerivation, error)
- func (kd *KeyDerivation) GetIndex() *big.Int
- func (kd *KeyDerivation) GetRootFingerPrint() []byte
- func (kd *KeyDerivation) ToKDMessage() *protos.KeyDerived
- 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)
- type PrivateKey
- func (priv *PrivateKey) Child(index *big.Int) (crypto.Hierarchical, error)
- func (priv *PrivateKey) ChildPublic(index *big.Int) (*PublicKey, error)
- func (priv *PrivateKey) FromPBMessage(msg proto.Message) error
- func (priv *PrivateKey) IsEqual(p interface{}) bool
- func (priv *PrivateKey) IsEqualForTest(otherPriv *PrivateKey) bool
- func (priv *PrivateKey) PBMessage() proto.Message
- func (priv *PrivateKey) Public() crypto.Verifier
- func (priv *PrivateKey) Sign(hash []byte) (sig *protos.Signature, err error)
- func (priv *PrivateKey) String() string
- func (priv *PrivateKey) ToECDSA() *ecdsa.PrivateKey
- type PublicKey
- func (pub *PublicKey) Child(index *big.Int) (crypto.Hierarchical, error)
- func (pub *PublicKey) Digest() []byte
- func (pub *PublicKey) FromPBMessage(msg proto.Message) error
- func (pub *PublicKey) IsEqual(p interface{}) bool
- func (pub *PublicKey) IsEqualForTest(otherPub *PublicKey) bool
- func (pub *PublicKey) PBMessage() proto.Message
- func (pub *PublicKey) Recover(sig *protos.Signature) error
- func (pub *PublicKey) String() string
- func (pub *PublicKey) ToECDSA() *ecdsa.PublicKey
- func (pub *PublicKey) Verify(hash []byte, sig *protos.Signature) bool
Constants ¶
View Source
const ( SECP256K1 int32 = iota + 1 ECP256_FIPS186 PUBLICKEY_FINGERPRINT_LEN = crypto.PUBLICKEY_FINGERPRINT_LEN )
View Source
const (
PublicKeyCompressedLength = 33
)
Variables ¶
View Source
var ( DefaultCurveType = ECP256_FIPS186 DefaultVersion = crypto.DefaultVersion DefaultFactory = cryptoFactory{} )
Functions ¶
Types ¶
type KeyDerivation ¶
type KeyDerivation struct { // underlying root private key fingerprint RootFingerPrint []byte // index of child private key Index *big.Int // chaincode Chaincode []byte }
func (*KeyDerivation) FromKDMessage ¶
func (kd *KeyDerivation) FromKDMessage(msg *protos.KeyDerived)
func (*KeyDerivation) GenIntermediary ¶
func (kd *KeyDerivation) GenIntermediary(pub *ecdsa.PublicKey, index *big.Int) ([]byte, *KeyDerivation, error)
func (*KeyDerivation) GetIndex ¶
func (kd *KeyDerivation) GetIndex() *big.Int
func (*KeyDerivation) GetRootFingerPrint ¶
func (kd *KeyDerivation) GetRootFingerPrint() []byte
func (*KeyDerivation) ToKDMessage ¶
func (kd *KeyDerivation) ToKDMessage() *protos.KeyDerived
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 }
A Koblitz Curve with a=0.
func (*KoblitzCurve) Add ¶
func (*KoblitzCurve) Double ¶
func (*KoblitzCurve) IsOnCurve ¶
func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool
func (*KoblitzCurve) Params ¶
func (curve *KoblitzCurve) Params() *elliptic.CurveParams
func (*KoblitzCurve) ScalarBaseMult ¶
type PrivateKey ¶
type PrivateKey struct { Version int32 // Curve type CurveType int32 // underlying private key Key *ecdsa.PrivateKey *KeyDerivation }
func NewDefaultPrivatekey ¶
func NewDefaultPrivatekey() (*PrivateKey, error)
func NewPrivatekey ¶
func NewPrivatekey(curveType int32) (*PrivateKey, error)
func NewSECP256K1Privkey ¶
func NewSECP256K1Privkey(s string) *PrivateKey
func (*PrivateKey) Child ¶
func (priv *PrivateKey) Child(index *big.Int) (crypto.Hierarchical, error)
func (*PrivateKey) ChildPublic ¶
func (priv *PrivateKey) ChildPublic(index *big.Int) (*PublicKey, error)
func (*PrivateKey) FromPBMessage ¶
func (priv *PrivateKey) FromPBMessage(msg proto.Message) error
func (*PrivateKey) IsEqual ¶
func (priv *PrivateKey) IsEqual(p interface{}) bool
func (*PrivateKey) IsEqualForTest ¶
func (priv *PrivateKey) IsEqualForTest(otherPriv *PrivateKey) bool
func (*PrivateKey) PBMessage ¶
func (priv *PrivateKey) PBMessage() proto.Message
func (*PrivateKey) Public ¶
func (priv *PrivateKey) Public() crypto.Verifier
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(hash []byte) (sig *protos.Signature, err error)
func (*PrivateKey) String ¶
func (priv *PrivateKey) String() string
Click to show internal directories.
Click to hide internal directories.