Make calls consistent.  Extract functions where it made sense.  Fix the error handling in Decrypt.
Export a sane API for test.
Use std::copy instead of memcpy for consistency.