Added Security::generateRandomHexKey(), used it for various tokens and default key generation

Fixes #4114.

Needs review.
We can't easily specify final string length i.e. for value `11` in your case string length will be 10.