Some refactoring; added util methods for RSA Key generation