improve security in key generation