Cryptlib squashed

1. added detailed certification validation error message.
2. refactored some previous written code.