Fixes #2053: refactor CSecurityManager and CPasswordHelper

Fixes #2053: refactor CSecurityManager and CPasswordHelper:

1. CPasswordHelper has been refactored.

2. CSecurityManager has been enhanced and now able to generate cryptographically strong random stuff.