ecies

package
v0.0.0-...-67070f9 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImport                     = fmt.Errorf("ecies: failed to import key")
	ErrInvalidCurve               = fmt.Errorf("ecies: invalid elliptic curve")
	ErrInvalidParams              = fmt.Errorf("ecies: invalid ECIES parameters")
	ErrInvalidPublicKey           = fmt.Errorf("ecies: invalid public key")
	ErrSharedKeyIsPointAtInfinity = fmt.Errorf("ecies: shared key is point at infinity")
	ErrSharedKeyTooBig            = fmt.Errorf("ecies: shared key params are too big")
)
View Source
var (
	ErrKeyDataTooLong = fmt.Errorf("ecies: can't supply requested key data")
	ErrSharedTooLong  = fmt.Errorf("ecies: shared secret is too long")
	ErrInvalidMessage = fmt.Errorf("ecies: invalid message")
)

Functions

func Decrypt

func Decrypt(prv *ethecies.PrivateKey, c, s1, s2 []byte) (m []byte, err error)

Decrypt decrypts an ECIES ciphertext.

func Encrypt

func Encrypt(rand io.Reader, pub *ethecies.PublicKey, m, s1, s2 []byte) (ct []byte, err error)

Encrypt encrypts a message using ECIES as specified in SEC 1, 5.1.

s1 and s2 contain shared information that is not part of the resulting ciphertext. s1 is fed into key derivation, s2 is fed into the MAC. If the shared information parameters aren't being used, they should be nil.

func GenerateKey

func GenerateKey(rand io.Reader, curve elliptic.Curve, params *ethecies.ECIESParams) (prv *ethecies.PrivateKey, err error)

Generate an elliptic curve public / private keypair. If params is nil, the recommended default parameters for the key will be chosen.

func GenerateShared

func GenerateShared(prv *ethecies.PrivateKey, pub *ethecies.PublicKey, skLen, macLen int) ([]byte, error)

ECDH key agreement method used to establish secret keys for encryption.

func MaxSharedKeyLength

func MaxSharedKeyLength(pub *ethecies.PublicKey) int

MaxSharedKeyLength returns the maximum length of the shared key the public key can produce.

Types

This section is empty.

Jump to

Keyboard shortcuts

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