ecdh

package
v0.0.78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ecdh has implementations for different asymmetric key exchange. Based on the Elliptic Curve Diffie-Hellman key agreement protocol.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEphemeralGenerate generic error when failing to geneate ephemeral keys
	ErrEphemeralGenerate = errors.New("ecdh: ephemeral generation failed")
	// ErrSharedSecretGenerate generic error when failing to geneate a shared secret
	ErrSharedSecretGenerate = errors.New("ecdh: shared secret generation failed")
)

Functions

This section is empty.

Types

type ED25519

type ED25519 struct {
	// contains filtered or unexported fields
}

func NewED25519

func NewED25519(rand io.Reader) (*ED25519, error)

func (ED25519) EphemeralKey

func (kx ED25519) EphemeralKey() (crypto.PrivateKey, error)

func (ED25519) SharedSecret

func (kx ED25519) SharedSecret(privateKey crypto.PrivateKey, publicKey crypto.PublicKey) ([]byte, error)

SharedSecret computes a secret value from a private / public key pair. On sending a message the private key should be an ephemeralKey or generated private key, the public key is the recipient public key. On reading a message the private key is the recipient private key, the public key is the ephemeralKey or generated public key.

type SECP256K1

type SECP256K1 struct {
	// contains filtered or unexported fields
}

func NewSECP256K1

func NewSECP256K1(rand io.Reader) (*SECP256K1, error)

func (SECP256K1) EphemeralKey

func (kx SECP256K1) EphemeralKey() (crypto.PrivateKey, error)

func (SECP256K1) SharedSecret

func (kx SECP256K1) SharedSecret(privateKey crypto.PrivateKey, publicKey crypto.PublicKey) ([]byte, error)

SharedSecret computes a secret value from a private / public key pair. On sending a message the private key should be an ephemeralKey or generated private key, the public key is the recipient public key. On reading a message the private key is the recipient private key, the public key is the ephemeralKey or generated public key.

type SR25519

type SR25519 struct {
	// contains filtered or unexported fields
}

func NewSR25519

func NewSR25519(rand io.Reader) (*SR25519, error)

func (SR25519) EphemeralKey

func (kx SR25519) EphemeralKey() (crypto.PrivateKey, error)

func (SR25519) SharedSecret

func (kx SR25519) SharedSecret(privateKey crypto.PrivateKey, publicKey crypto.PublicKey) ([]byte, error)

SharedSecret computes a secret value from a private / public key pair. On sending a message the private key should be an ephemeralKey or generated private key, the public key is the recipient public key. On reading a message the private key is the recipient private key, the public key is the ephemeralKey or generated public key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL