package ecdh
import "github.com/ProtonMail/go-crypto/openpgp/ecdh"
Package ecdh implements ECDH encryption, suitable for OpenPGP, as specified in RFC 6637, section 8.
Index ¶
- Constants
- func Decrypt(priv *PrivateKey, vsG, c, curveOID, fingerprint []byte) (msg []byte, err error)
- func DeriveProxyParam(recipientKey, forwardeeKey *PrivateKey) (proxyParam []byte, err error)
- func Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)
- func ProxyTransform(ephemeral, proxyParam []byte) ([]byte, 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
Constants ¶
const ( KDFVersion1 = 1 KDFVersionForwarding = 255 )
Functions ¶
func Decrypt ¶
func Decrypt(priv *PrivateKey, vsG, c, curveOID, fingerprint []byte) (msg []byte, err error)
func DeriveProxyParam ¶
func DeriveProxyParam(recipientKey, forwardeeKey *PrivateKey) (proxyParam []byte, err error)
func Encrypt ¶
func Encrypt(random io.Reader, pub *PublicKey, msg, curveOID, fingerprint []byte) (vsG, c []byte, err error)
func ProxyTransform ¶
func Validate ¶
func Validate(priv *PrivateKey) error
Types ¶
type KDF ¶
type KDF struct {
Version int // Defaults to v1; 255 for forwarding
Hash algorithm.Hash
Cipher algorithm.Cipher
ReplacementFingerprint []byte // (forwarding only) fingerprint to use instead of recipient's (20 octets)
}
func (*KDF) Serialize ¶
type PrivateKey ¶
func GenerateKey ¶
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 ¶
func NewPublicKey ¶
func (*PublicKey) GetCurve ¶
func (*PublicKey) MarshalPoint ¶
func (*PublicKey) UnmarshalPoint ¶
Source Files ¶
- Version
- v1.1.4-proton
- Published
- Jan 7, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 53 seconds ago –
Tools for package owners.