Documentation ¶
Overview ¶
Provides ECIES implementation using: sha256 hashing , secp256k1 curves, and aes 128 ctr (16 byte key) encryption.
Code in this package was built from the following 2 docs: 1. https://csrc.nist.gov/CSRC/media/Publications/sp/800-56a/archive/2006-05-03/documents/sp800-56-draft-jul2005.pdf 2. https://github.com/ethereum/devp2p/blob/master/rlpx.md#ecies-encryption
Index ¶
Constants ¶
const Overhead = 113
Overhead is the length in bytes of the ECIES message *excluding* the ciphertext length. It is 65 (uncompressed public key) + 16 (IV) + 32 (MAC).
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypts ciphertext using prvKey using the following construction:
ciphertext = R || iv || c || d S = Px where (Px, Py) = kB * R kE || kM = KDF(S, 32) d == MAC(sha256(kM), iv || c || shared) msg = AES(kE, iv || c)
func Encrypt ¶
Encrypts msg to destPubKey using the following construction:
r = random number (private key) R = r * G (public key) S = Px where (Px, Py) = r * KB kE || kM = KDF(S, 32) iv = random initialization vector c = AES(kE, iv , m) d = MAC(sha256(kM), iv || c || shared) msg = R || iv || c || d For more details, see the ECIES Encryption docs defined by Eth's DevP2P: https://github.com/ethereum/devp2p/blob/master/rlpx.md#ecies-encryption
Types ¶
This section is empty.