def file_key_regenerate( blockchain_id, hostname, config_path=CONFIG_PATH, wallet_keys=None ):
config_dir = os.path.dirname(config_path)<EOL>current_key = file_key_lookup( blockchain_id, <NUM_LIT:0>, hostname, config_path=config_path )<EOL>if '<STR_LIT:status>' in current_key and current_key['<STR_LIT:status>']:<EOL><INDENT>res = file_key_retire( blockchain_id, current_key, config_path=config_path, wallet_keys=wallet_keys )<EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>log.error("<STR_LIT>" % (current_key['<STR_LIT>'], res['<STR_LIT:error>']))<EOL>return {'<STR_LIT:error>': '<STR_LIT>'}<EOL><DEDENT><DEDENT>res = blockstack_gpg.gpg_app_create_key( blockchain_id, "<STR_LIT>", hostname, wallet_keys=wallet_keys, config_dir=config_dir )<EOL>if '<STR_LIT:error>' in res:<EOL><INDENT>log.error("<STR_LIT>" % res['<STR_LIT:error>'])<EOL>return {'<STR_LIT:error>': '<STR_LIT>'}<EOL><DEDENT>return {'<STR_LIT:status>': True}<EOL>
Generate a new encryption key.
Retire the existing key, if it exists.
Return {'status': True} on success
Return {'error': ...} on error