Code for using ECIES to protect data (ECC + AES + SHA)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Code for using ECIES to protect data (ECC + AES + SHA)

Ladar Levison-2
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.

Ladar Levison
Lavabit LLC

example.c (3K) Download Attachment
ecies.c (12K) Download Attachment
ecies.h (1K) Download Attachment
keys.c (7K) Download Attachment
secure.c (1K) Download Attachment