Throw errors instead of panicing in Encrypt

Changed all the panics in the Encrypt method to returning errors
instead. Also updated the tests for this change.
Merge pull request #3 from cgt/errors

Throw errors instead of panicing (thanks to cgt).