def _decrypt_ciphertext(cipher, translate_newlines=False):
 cmd = [_get_gpg_exec(), '--homedir', _get_key_dir(), '-d']
 proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=False)
 (decrypted_data, decrypt_error) = proc.communicate(input=(cipher.replace('\\n', '\n') if translate_newlines else cipher))
 if (not decrypted_data):
  log.warning('Could not decrypt cipher %s, received: %s', cipher, decrypt_error)
  return cipher
 else:
  return str(decrypted_data)

def _decrypt_ciphertext ( cipher , translate_newlines = False ) : cmd = [ _get_gpg_exec ( ) , '--homedir' , _get_key_dir ( ) , '-d' ] proc = Popen ( cmd , stdin = PIPE , stdout = PIPE , stderr = PIPE , shell = False ) ( decrypted_data , decrypt_error ) = proc . communicate ( input = ( cipher . replace ( '\\n' , '\n' ) if translate_newlines else cipher ) ) if ( not decrypted_data ) : log . warning ( 'Could not decrypt cipher %s, received: %s' , cipher , decrypt_error ) return cipher else : return str ( decrypted_data )
given a block of ciphertext as a string .