Documentation ¶
Index ¶
- func NewID(bytes *[]byte) (out proto.ID)
- type Priv
- func (r *Priv) AsEC() (ecpriv *ecdsa.PrivateKey)
- func (r *Priv) Bytes() (out *[]byte)
- func (r *Priv) Copy(in *[]byte) proto.Buffer
- func (r *Priv) Free() proto.Buffer
- func (r *Priv) GetID() proto.ID
- func (r *Priv) Invalidate() *Priv
- func (r *Priv) IsValid() bool
- func (r *Priv) Make() *Priv
- func (r *Priv) PubKey() proto.Buffer
- func (r *Priv) SetKey(priv *[]byte, pub *[]byte) *Priv
- func (r *Priv) Sign(h *[]byte) (out *Sig)
- func (r *Priv) SignCompact(h *[]byte) (out *Sig)
- func (r *Priv) WithBC(bc *blockcrypt.BlockCrypt) *Priv
- func (r *Priv) Zero() proto.Buffer
- type Pub
- func (r *Pub) AsCompressed() (out *buf.Byte)
- func (r *Pub) AsEC() (out *ecdsa.PublicKey)
- func (r *Pub) AsHybrid() (out *buf.Byte)
- func (r *Pub) AsUncompressed() (out *buf.Byte)
- func (r *Pub) Bytes() (out *[]byte)
- func (r *Pub) Compress() *Pub
- func (r *Pub) Copy(in *[]byte) proto.Buffer
- func (r *Pub) Decompress() *Pub
- func (r *Pub) Free() proto.Buffer
- func (r *Pub) GetID() proto.ID
- func (r *Pub) ID() (out *buf.Byte)
- func (r *Pub) IsCompressed() bool
- func (r *Pub) Zero() proto.Buffer
- type Sig
- type Store
- func (r *Store) AddPriv(priv *Priv) *Store
- func (r *Store) AddPub(pub *Pub) *Store
- func (r *Store) Decrypt() *Store
- func (r *Store) Encrypt(bc *blockcrypt.BlockCrypt) *Store
- func (r *Store) Find(id proto.ID) (out *Priv)
- func (r *Store) OK() bool
- func (r *Store) Remove(id proto.ID) *Store
- func (r *Store) SetStatus(s string) proto.Status
- func (r *Store) SetStatusIf(err error) proto.Status
- func (r *Store) UnsetStatus() proto.Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Priv ¶
Priv is a private key, stored in a Crypt
func (*Priv) AsEC ¶
func (r *Priv) AsEC() (ecpriv *ecdsa.PrivateKey)
AsEC returns the key in ecdsa.PrivateKey format
func (*Priv) Invalidate ¶
Invalidate zeroes the key and marks it invalid
func (*Priv) Make ¶
Make generates a new private key from random bytes. By default it uses compressed format for the public key, to get another format append a further decompression or hybrid method invocation.
func (*Priv) SetKey ¶
SetKey loads a private key from raw bytes, and zeroes the input bytes of the private key
func (*Priv) SignCompact ¶
SignCompact produces a compact signature for BTC type systems
func (*Priv) WithBC ¶
func (r *Priv) WithBC(bc *blockcrypt.BlockCrypt) *Priv
WithBC copies in the reference to a BlockCrypt to enable encryption
type Pub ¶
Pub is a secp256k1 EC public key which can be represented as a compressed, uncompressed or hybrid for wire and storage
func (*Pub) AsCompressed ¶
AsCompressed returns the compressed serialised form (33 bytes, prefix 2 or 3 depending on whether y is odd or even)
func (*Pub) AsHybrid ¶
AsHybrid returns the uncompressed serialised form with the first byte taken from the first bit of the y coordinate, either 0 or 1, with both x and y coordinates (this is not really used)
func (*Pub) AsUncompressed ¶
AsUncompressed returns the uncompressed serialised form (65 bytes with x and y with the prefix 4)
func (*Pub) Decompress ¶
Decompress converts the key to compressed format if it is in anothter format
func (*Pub) IsCompressed ¶
IsCompressed returns true if the key is compressed
type Sig ¶
Sig is a bitcoin EC signature
type Store ¶
type Store struct { BC *blockcrypt.BlockCrypt Status string // contains filtered or unexported fields }
Store is a keychain for public and private keys
func (*Store) Encrypt ¶
func (r *Store) Encrypt(bc *blockcrypt.BlockCrypt) *Store
Encrypt sets the store to encrypt private keys
func (*Store) Find ¶
Find returns the key with matching ID as requested. The return type is Priv but if there is no private key the field is empty