ecdh

package
v0.0.0-...-86ae774 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

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, c, 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 Validate

func Validate(priv *PrivateKey) 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(rand io.Reader, c ecc.ECDHCurve, kdf KDF) (priv *PrivateKey, err error)

func NewPrivateKey

func NewPrivateKey(key PublicKey) *PrivateKey

func (*PrivateKey) MarshalByteSecret

func (sk *PrivateKey) MarshalByteSecret() []byte

func (*PrivateKey) UnmarshalByteSecret

func (sk *PrivateKey) UnmarshalByteSecret(d []byte) error

type PublicKey

type PublicKey struct {
	Point []byte
	KDF
	// contains filtered or unexported fields
}

func NewPublicKey

func NewPublicKey(curve ecc.ECDHCurve, kdfHash algorithm.Hash, kdfCipher algorithm.Cipher) *PublicKey

func (*PublicKey) GetCurve

func (pk *PublicKey) GetCurve() ecc.ECDHCurve

func (*PublicKey) MarshalPoint

func (pk *PublicKey) MarshalPoint() []byte

func (*PublicKey) UnmarshalPoint

func (pk *PublicKey) UnmarshalPoint(p []byte) error

Jump to

Keyboard shortcuts

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