Exercises: ECC-Based Asymmetric Encrypt / Decrypt (ECIES)

Write a program to encrypt / decrypt a message by public / private key using ECIES (Elliptic Curve Integrated Encryption Scheme). The encryption will require an EC public key and decryption will require the corresponding EC private key. Internally, use ECC cryptography based on a 256-bit elliptic curve by choice (e.g. brainpoolP256t1) and symmetric encryption by choice (e.g. AES-256-CTR + MAC, AES-128-GCM or ChaCha20-Poly1305), along with key-derivation function by choice (e.g. PBKDF2).

You are free to choose between writing your own ECIES implementation, following the SECG-SEC-1 standard or use a standard ECIES library for your language, e.g.

ECIES Encryption

Write a program to encrypt a message using the ECIES hybrid encryption scheme and a 256-bit ECC public key (2 * 256 bits).

The input consists of the public key in hex (at the first line, uncompressed, 128 hex digits) + plaintext message for encryption (at the second line).

The output is the hex-encoded encrypted message. It may hold the ECC ciphertext public key + the ciphertext + MAC code + the symmetric key algorithm parameters, but this depends very much on the underlying algorithms and implementation.