Package ecdh
import "github.com/ProtonMail/go-crypto/openpgp/ecdh"
- Overview
- Index
Package ecdh implements ECDH encryption, suitable for OpenPGP,
as specified in RFC 6637, section 8.
- func Decrypt(priv *PrivateKey, vsG, c, curveOID, fingerprint []byte) (msg []byte, err error)
- func Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)
- func Validate(priv *PrivateKey) error
- type KDF
- type PrivateKey
- func GenerateKey(rand io.Reader, c ecc.ECDHCurve, kdf KDF) (priv *PrivateKey, err error)
- func NewPrivateKey(key PublicKey) *PrivateKey
- func (sk *PrivateKey) MarshalByteSecret() []byte
- func (sk *PrivateKey) UnmarshalByteSecret(d []byte) error
- type PublicKey
- func NewPublicKey(curve ecc.ECDHCurve, kdfHash algorithm.Hash, kdfCipher algorithm.Cipher) *PublicKey
- func (pk *PublicKey) GetCurve() ecc.ECDHCurve
- func (pk *PublicKey) MarshalPoint() []byte
- func (pk *PublicKey) UnmarshalPoint(p []byte) error
Package files
ecdh.go
func Decrypt(priv *PrivateKey, vsG, c, curveOID, fingerprint []byte) (msg []byte, err error)
func Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)
func Validate(priv *PrivateKey) error
type KDF struct {
Hash algorithm.Hash
Cipher algorithm.Cipher
}
type PrivateKey struct {
PublicKey
D []byte
}
func GenerateKey(rand io.Reader, c ecc.ECDHCurve, kdf KDF) (priv *PrivateKey, err error)
func NewPrivateKey(key PublicKey) *PrivateKey
func (sk *PrivateKey) MarshalByteSecret() []byte
func (sk *PrivateKey) UnmarshalByteSecret(d []byte) error
type PublicKey struct {
Point []byte
KDF
}
func NewPublicKey(curve ecc.ECDHCurve, kdfHash algorithm.Hash, kdfCipher algorithm.Cipher) *PublicKey
func (*PublicKey) GetCurve
¶
func (pk *PublicKey) GetCurve() ecc.ECDHCurve
func (pk *PublicKey) MarshalPoint() []byte
func (pk *PublicKey) UnmarshalPoint(p []byte) error