package ecies

import "go.dedis.ch/kyber/v3/encrypt/ecies"

Package ecies implements the Elliptic Curve Integrated Encryption Scheme (ECIES).

Index

Functions

func Decrypt

func Decrypt(group kyber.Group, private kyber.Scalar, ctx []byte, hash func() hash.Hash) ([]byte, error)

Decrypt first computes a shared DH key using the received ephemeral elliptic curve point (stored in the first part of ctx), then HKDF-derives a symmetric key (and nonce) from that, and finally uses these values to decrypt the given ciphertext (stored in the second part of ctx) via AES-GCM. If the hash input parameter is nil then SHA256 is used as a default. Decrypt returns the plaintext message or an error.

func Encrypt

func Encrypt(group kyber.Group, public kyber.Point, message []byte, hash func() hash.Hash) ([]byte, error)

Encrypt first computes a shared DH key using the given public key, then HKDF-derives a symmetric key (and nonce) from that, and finally uses these values to encrypt the given message via AES-GCM. If the hash input parameter is nil then SHA256 is used as a default. Encrypt returns a byte slice containing the ephemeral elliptic curve point of the DH key exchange and the ciphertext or an error.

Source Files

ecies.go

Version
v3.1.0 (latest)
Published
Nov 30, 2022
Platform
linux/amd64
Imports
9 packages
Last checked
1 month ago

Tools for package owners.