mailchain: github.com/mailchain/mailchain/crypto/cipher/ecdh Index | Files

package ecdh

import "github.com/mailchain/mailchain/crypto/cipher/ecdh"

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

Index

Package Files

ecdh.go ed25519.go errors.go secp256k1.go sr25519.go

Variables

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")
)

type ED25519 Uses

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

func NewED25519 Uses

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

func (ED25519) EphemeralKey Uses

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

func (ED25519) SharedSecret Uses

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 Uses

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

func NewSECP256K1 Uses

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

func (SECP256K1) EphemeralKey Uses

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

func (SECP256K1) SharedSecret Uses

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 Uses

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

func NewSR25519 Uses

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

func (SR25519) EphemeralKey Uses

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

func (SR25519) SharedSecret Uses

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.

Package ecdh imports 12 packages (graph) and is imported by 1 packages. Updated 2020-04-06. Refresh now. Tools for package owners.