Code for using ECIES to protect data (ECC + AES + SHA)
Since I couldn't find any code showing how to protect arbitrary blocks
of data using OpenSSL's implementation of ECC+AES I've decided to share
what I developed by posting it to the list. The goal was to follow the
SECG standard for ECIES. I only gave the document describing the
standard a cursory reading and would welcome anyone's feedback.
Hopefully someday I'll be able to use the EVP_Seal interface to
accomplish the same thing as the code I'm sending out. ;)
On a side note, I started working on this code in an effort to replace
an equivalent piecemeal implementation I built years ago atop Libgcrypt.
Naturally I ran a number of simple benchmarks to compare my new
implementation based on OpenSSL against the older Libgcrypt code. I was
pleasantly surprised find the OpenSSL implementation ~10 to ~15 times
faster depending on the size of the data I encrypted/decrypted (using
equivalent curves/key sizes).
I hereby place the attached code in the public domain. As such it comes
without any warranty regarding its merchantability or fitness for a
particular purpose. Please use it at your own risk.