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") ErrInvalidPublicKey = fmt.Errorf("ecies: invalid public key") )
View Source
var ( ErrInvalidMessage = fmt.Errorf("ecies: invalid message") )
View Source
var ( ErrUnsupportedECDHAlgorithm = fmt.Errorf("ecies: unsupported ECDH algorithm") ErrUnsupportedECIESParameters = fmt.Errorf("ecies: unsupported ECIES parameters") ErrInvalidKeyLen = fmt.Errorf("ecies: invalid key size (> %d) in ECIESParams", maxKeyLen) )
View Source
var ECIES_AES128_SHA256 = &ECIESParams{ Hash: sha256.New, hashAlgo: crypto.SHA256, Cipher: aes.NewCipher, BlockSize: aes.BlockSize, KeyLen: 16, }
Functions ¶
Types ¶
type ECIESParams ¶
type ECIESParams struct { Hash func() hash.Hash // hash function Cipher func([]byte) (cipher.Block, error) // symmetric cipher BlockSize int // block size of symmetric cipher KeyLen int // length of symmetric key // contains filtered or unexported fields }
func ParamsFromCurve ¶
func ParamsFromCurve() (params *ECIESParams)
type PrivateKey ¶
PrivateKey is a representation of an elliptic curve private key.
func GenerateKey ¶
func GenerateKey(rand io.Reader, params *ECIESParams) (prv *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 ImportEDDSA ¶
func ImportEDDSA(prv *eddsa.PrivateKey) *PrivateKey
Import an EDDSA private key as an ECIES private key.
func (*PrivateKey) Decrypt ¶
func (prv *PrivateKey) Decrypt(c, s1, s2 []byte) (m []byte, err error)
Decrypt decrypts an ECIES ciphertext.
func (*PrivateKey) ExportEDDSA ¶
func (prv *PrivateKey) ExportEDDSA() *eddsa.PrivateKey
Export an ECIES private key as an EDDSA private key.
func (*PrivateKey) GenerateShared ¶
func (prv *PrivateKey) GenerateShared(pub *PublicKey, skLen, macLen int) (sk []byte, err error)
ECDH key agreement method used to establish secret keys for encryption.
type PublicKey ¶
type PublicKey struct { X []byte Params *ECIESParams }
PublicKey is a representation of an elliptic curve public key.
func ImportEDDSAPublic ¶
Import an EDDSA public key as an ECIES public key.
func (*PublicKey) ExportEDDSA ¶
Export an ECIES public key as an EDDSA public key.
Click to show internal directories.
Click to hide internal directories.