Documentation ¶
Index ¶
- Variables
- func Decrypt(prv *ethecies.PrivateKey, c, s1, s2 []byte) (m []byte, err error)
- func Encrypt(rand io.Reader, pub *ethecies.PublicKey, m, s1, s2 []byte) (ct []byte, err error)
- func GenerateKey(rand io.Reader, curve elliptic.Curve, params *ethecies.ECIESParams) (prv *ethecies.PrivateKey, err error)
- func GenerateShared(prv *ethecies.PrivateKey, pub *ethecies.PublicKey, skLen, macLen int) ([]byte, error)
- func MaxSharedKeyLength(pub *ethecies.PublicKey) int
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") )
View Source
var ( ErrKeyDataTooLong = fmt.Errorf("ecies: can't supply requested key data") 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 ¶
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 ¶
MaxSharedKeyLength returns the maximum length of the shared key the public key can produce.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.