Exemple #1
0
def save_private_keys(batch_privs, public_key, filename, encrypt):
    if (encrypt):
        encrypted_privs = encrypt_message(batch_privs.encode('utf8'),
                                          public_key)
        with open(filename, 'w') as file:
            file.write(encrypted_privs.decode('utf8'))
    else:
        with open(filename.replace('_encrypted', '_unencrypted'), 'w') as file:
            file.write(batch_privs)
Exemple #2
0
 def do_send(self, tx):
     for window, xpub, K, _hash in self.cosigner_list:
         if not self.cosigner_can_sign(tx, xpub):
             continue
         message = bitcoin.encrypt_message(tx.raw, K)
         try:
             server.put(_hash, message)
         except Exception as e:
             traceback.print_exc(file=sys.stdout)
             window.show_message("Failed to send transaction to cosigning pool.")
             return
         window.show_message("Your transaction was sent to the cosigning pool.\nOpen your cosigner wallet to retrieve it.")
Exemple #3
0
 def doEncrypt(self) -> None:
     message = self.topTvDel.text
     message = message.encode('utf-8')
     pubkey = self.tf.text.strip()
     encryptedTVDel = self.botTvDel
     
     if not pubkey:
         parent().show_message(_("Please provide a public key or select an address"))
         return
     
     try:
         encrypted = bitcoin.encrypt_message(message, pubkey)
         encryptedTVDel.text = str(encrypted.decode('ascii'))
     except BaseException as e:
         traceback.print_exc(file=sys.stdout)
         parent().show_error(str(e))
    def notification_outputs(self,contract_address):
        if not self.disabled:
            outputs = []
            fee = 0
            str = random.choice(string.ascii_letters+ string.punctuation + string.digits)+'\'' # salt
            if self.notify_me.isChecked():
                str += self.my_email.text()+'\''
                fee += self.nottify_me_fee

            if self.notify_inheritor.isChecked():

                str += self.i_email.text() + '\'' +contract_address.to_ui_string()
                fee += self.nottify_inheritor_fee
            message = base64.b64decode(encrypt_message(str.encode('utf8'),self.licho_pubkey))[4:]
            print(message)
            outputs.append((TYPE_ADDRESS, self.licho_address, fee))
            outputs.append( (TYPE_SCRIPT, ScriptOutput(make_opreturn(message)), 0) )
            return outputs
Exemple #5
0
 def do_send(self, d):
     tx = d.tx
     window, state = self._find_window_and_state_for_wallet(d.wallet)
     if not tx or not window or not state:
         self.print_error("Missing tx or window or state")
         return
     for xpub, K, _hash in state.cosigner_list:
         if not self.cosigner_can_sign(tx, xpub):
             continue
         message = bitcoin.encrypt_message(bfh(tx.raw),
                                           bh2u(K)).decode('ascii')
         try:
             state.server.put(_hash, message)
         except Exception as e:
             traceback.print_exc(file=sys.stdout)
             window.show_error(
                 _("Failed to send transaction to cosigning pool."))
             return
         d.show_message(
             _("Your transaction was sent to the cosigning pool.") + '\n' +
             _("Open your cosigner wallet to retrieve it."))