Exemplo n.º 1
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     if self.has_seed():
         decoded = pw_decode(self.seed, old_password)
         self.seed = pw_encode(decoded, new_password)
Exemplo n.º 2
0
def decrypt_file(filename, pw):
    with open("key.json", "r") as f:
        dd = json.load(f)
    sk_str = crypto.pw_decode(dd["private_key_enc"],
                              pw,
                              version=crypto.PW_HASH_VERSION_LATEST)
    return sk_str
Exemplo n.º 3
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     for k, v in self.keypairs.items():
         b = pw_decode(v, old_password)
         c = pw_encode(b, new_password)
         self.keypairs[k] = c
Exemplo n.º 4
0
 def get_private_key(self, pubkey, password):
     sec = pw_decode(self.keypairs[pubkey], password)
     txin_type, privkey, compressed = deserialize_privkey(sec)
     # this checks the password
     if pubkey != ecc.ECPrivkey(privkey).get_public_key_hex(
             compressed=compressed):
         raise InvalidPassword()
     return privkey, compressed
Exemplo n.º 5
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     if self.has_seed():
         decoded = self.get_seed(old_password)
         self.seed = pw_encode(decoded, new_password)
     if self.passphrase:
         decoded = self.get_passphrase(old_password)
         self.passphrase = pw_encode(decoded, new_password)
     if self.xprv is not None:
         b = pw_decode(self.xprv, old_password)
         self.xprv = pw_encode(b, new_password)
Exemplo n.º 6
0
 def get_hex_seed(self, password):
     return pw_decode(self.seed, password).encode('utf8')
Exemplo n.º 7
0
 def check_password(self, password):
     xprv = pw_decode(self.xprv, password)
     if deserialize_xprv(xprv)[4] != deserialize_xpub(self.xpub)[4]:
         raise InvalidPassword()
Exemplo n.º 8
0
 def get_master_private_key(self, password):
     return pw_decode(self.xprv, password)
Exemplo n.º 9
0
 def get_passphrase(self, password):
     return pw_decode(self.passphrase, password) if self.passphrase else ''
Exemplo n.º 10
0
 def get_seed(self, password):
     return pw_decode(self.seed, password)