added option to recurcive directory creation when generating a key