Replace DefaultKeyGenerator with other alternative. and allow user to override with their own keygen (if needed)

Functional test included. 
*I need to modify the buildConfig, otherwise the functional test won't work in my local env.

Please help to verify. Thanks :)