ecdh

package
v0.0.0-...-6e2ca06 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package ecdh implements ECDH encryption, suitable for OpenPGP, as specified in RFC 6637, section 8.

Package ecdh implements ECDH encryption, suitable for OpenPGP, as specified in RFC 6637, section 8.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(priv *PrivateKey, vsG, m, curveOID, fingerprint []byte) (msg []byte, err error)

func Encrypt

func Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)

func X25519Decrypt

func X25519Decrypt(priv *PrivateKey, vsG, m, curveOID, fingerprint []byte) (msg []byte, err error)

func X25519Encrypt

func X25519Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)

Types

type KDF

type KDF struct {
	Hash   algorithm.Hash
	Cipher algorithm.Cipher
}

type PrivateKey

type PrivateKey struct {
	PublicKey
	D []byte
}

func GenerateKey

func GenerateKey(c elliptic.Curve, kdf KDF, rand io.Reader) (priv *PrivateKey, err error)

func X25519GenerateKey

func X25519GenerateKey(rand io.Reader, kdf KDF) (priv *PrivateKey, err error)

X25519GenerateKey samples the key pair according to the correct distribution. It also sets the given key-derivation function and returns the *PrivateKey object along with an error.

type PublicKey

type PublicKey struct {
	ecc.CurveType
	elliptic.Curve
	X, Y *big.Int
	KDF
}

Jump to

Keyboard shortcuts

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