add crypto test
add error handling
Merge pull request #526 from luvit/port-crypto

add crypto test