Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PrivateKey ¶
PrivateKey is an instance of secp256k1 private key with nested public key
func NewPrivateKeyFromBytes ¶
func NewPrivateKeyFromBytes(priv []byte) *PrivateKey
NewPrivateKeyFromBytes decodes private key raw bytes, computes public key and returns PrivateKey instance
func NewPrivateKeyFromHex ¶
func NewPrivateKeyFromHex(s string) (*PrivateKey, error)
NewPrivateKeyFromHex decodes hex form of private key raw bytes, computes public key and returns PrivateKey instance
func (*PrivateKey) ECDH ¶
func (k *PrivateKey) ECDH(pub *PublicKey) ([]byte, error)
ECDH derives shared secret; Must not be used as encryption key, it increases chances to perform successful key restoration attack
func (*PrivateKey) Encapsulate ¶
func (k *PrivateKey) Encapsulate(pub *PublicKey) ([]byte, error)
Encapsulate encapsulates key by using Key Encapsulation Mechanism and returns symmetric key; can be safely used as encryption key
func (*PrivateKey) Equals ¶
func (k *PrivateKey) Equals(priv *PrivateKey) bool
Equals compares two private keys with constant time (to resist timing attacks)
func (*PrivateKey) Hex ¶
func (k *PrivateKey) Hex() string
Hex returns private key bytes in hex form
type PublicKey ¶
PublicKey instance with nested elliptic.Curve interface (secp256k1 instance in our case)
func NewPublicKeyFromBytes ¶
NewPublicKeyFromBytes decodes public key raw bytes and returns PublicKey instance; Supports both compressed and uncompressed public keys
func NewPublicKeyFromHex ¶
NewPublicKeyFromHex decodes hex form of public key raw bytes and returns PublicKey instance
func (*PublicKey) Bytes ¶
Bytes returns public key raw bytes; Could be optionally compressed by dropping Y part
func (*PublicKey) Decapsulate ¶
func (k *PublicKey) Decapsulate(priv *PrivateKey) ([]byte, error)
Decapsulate decapsulates key by using Key Encapsulation Mechanism and returns symmetric key; can be safely used as encryption key