Define CryptoException and tidy main crypto header
Add implementation for error functions