Exemplo n.º 1
0
 def get_password_for_storage_encryption(self) -> str:
     derivation = get_derivation_used_for_hw_device_encryption()
     derivation_list = bip32.convert_bip32_path_to_list_of_uint32(
         derivation)
     xpub = self.bitbox02_device.electrum_encryption_key(derivation_list)
     node = bip32.BIP32Node.from_xkey(
         xpub, net=constants.BitcoinMainnet()).subkey_at_public_derivation(
             ())
     return node.eckey.get_public_key_bytes(compressed=True).hex()
Exemplo n.º 2
0
def get_password_for_hw_device_encrypted_storage(plugins):
    devices = get_connected_hw_devices(plugins)
    if len(devices) == 0:
        print_msg("Error: No connected hw device found. Can not decrypt this wallet.")
        sys.exit(1)
    elif len(devices) > 1:
        print_msg("Warning: multiple hardware devices detected. "
                  "The first one will be used to decrypt the wallet.")
    # FIXME we use the "first" device, in case of multiple ones
    name, device_info = devices[0]
    plugin = plugins.get_plugin(name)
    derivation = get_derivation_used_for_hw_device_encryption()
    xpub = plugin.get_xpub(device_info.device.id_, derivation, 'standard', plugin.handler)
    password = keystore.Xpub.get_pubkey_from_xpub(xpub, ())
    return password
Exemplo n.º 3
0
 def get_password_for_storage_encryption(self) -> str:
     # note: using a different password based on hw device type is highly undesirable! see #5993
     derivation = get_derivation_used_for_hw_device_encryption()
     xpub = self.get_xpub(derivation, "standard")
     password = Xpub.get_pubkey_from_xpub(xpub, ()).hex()
     return password