Refactor crypto API and add basic test cases
Fix failing test case due to crash when no listener is running
Merge branch 'master' of github.com:TheDistributedBay/TheDistributedBay