def file_encrypt( blockchain_id, hostname, recipient_blockchain_id_and_hosts, input_path, output_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ):
config_dir = os.path.dirname(config_path)<EOL>key_info = file_key_lookup( blockchain_id, <NUM_LIT:0>, hostname, config_path=config_path, wallet_keys=wallet_keys )<EOL>if '<STR_LIT:error>' in key_info:<EOL><INDENT>return {'<STR_LIT:error>': '<STR_LIT>'}<EOL><DEDENT>recipient_keys = []<EOL>for (recipient_id, recipient_hostname) in recipient_blockchain_id_and_hosts:<EOL><INDENT>if recipient_id == blockchain_id and recipient_hostname == hostname:<EOL><INDENT>recipient_keys.append(key_info)<EOL>continue<EOL><DEDENT>recipient_info = file_key_lookup( recipient_id, <NUM_LIT:0>, recipient_hostname, config_path=config_path, wallet_keys=wallet_keys )<EOL>if '<STR_LIT:error>' in recipient_info:<EOL><INDENT>return {'<STR_LIT:error>': "<STR_LIT>" % recipient_id}<EOL><DEDENT>recipient_keys.append(recipient_info)<EOL><DEDENT>res = None<EOL>with open(input_path, "<STR_LIT:r>") as f:<EOL><INDENT>res = blockstack_gpg.gpg_encrypt( f, output_path, key_info, recipient_keys, passphrase=passphrase, config_dir=config_dir )<EOL><DEDENT>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, '<STR_LIT>': key_info['<STR_LIT>']}<EOL>
Encrypt a file for a set of recipients.
@recipient_blockchain_id_and_hosts must contain a list of (blockchain_id, hostname)
Return {'status': True, 'sender_key_id': ...} on success, and write ciphertext to output_path
Return {'error': ...} on error