Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct { PrivateKey *PrivateKey PublicKey *PublicKey }
KeyPair represents the generated ephemeral elliptic curve private and public key pair
func GenerateKeyPair ¶
GenerateKeyPair generates a pair of public and private elliptic curve ephemeral key that can be used as an input for ECDH.
type PrivateKey ¶
type PrivateKey btcec.PrivateKey
PrivateKey is an ephemeral private elliptic curve key.
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(bytes []byte) *PrivateKey
UnmarshalPrivateKey turns a slice of bytes into a `PrivateKey`.
func (*PrivateKey) Ecdh ¶
func (pk *PrivateKey) Ecdh(publicKey *PublicKey) *SymmetricEcdhKey
Ecdh performs Elliptic Curve Diffie-Hellman operation between public and private key. The returned value is `SymmetricEcdhKey` that can be used for encryption and decryption.
func (*PrivateKey) Marshal ¶
func (pk *PrivateKey) Marshal() []byte
Marshal turns a `PrivateKey` into a slice of bytes.
type PublicKey ¶
PublicKey is an ephemeral public elliptic curve key.
func UnmarshalPublicKey ¶
UnmarshalPublicKey turns a slice of bytes into a `PublicKey`.
func (*PublicKey) IsKeyMatching ¶
func (pk *PublicKey) IsKeyMatching(privateKey *PrivateKey) bool
IsKeyMatching verifies if private key is valid for given public key. It checks if public key equals `g^privateKey`, where `g` is a base point of the curve.
type SymmetricEcdhKey ¶
type SymmetricEcdhKey struct {
// contains filtered or unexported fields
}
SymmetricEcdhKey is an ephemeral Elliptic Curve key created with Diffie-Hellman key exchange and implementing `SymmetricKey` interface.