Exemple #1
0
 def test_derive_child_hardened_no_privkey(self):
     pk = bytes.fromhex(
         '02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e'
     )  # noqa: E501
     node = HDKey.from_pubkey(pk)
     with self.assertRaises(ValueError) as context:
         node.derive_child('1h')
     self.assertIn('Need private key', str(context.exception))
Exemple #2
0
    def test_sign_errors(self):
        pk = bytes.fromhex(
            '02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e'
        )  # noqa: E501
        node = HDKey.from_pubkey(pk)

        with self.assertRaises(ValueError) as context:
            node.sign(b'\x00')
        self.assertIn('without privkey', str(context.exception))

        with self.assertRaises(ValueError) as context:
            node.sign_hash(b'\x00' * 32)
        self.assertIn('without privkey', str(context.exception))
Exemple #3
0
 def test_from_pubkey(self):
     pk = bytes.fromhex(
         '02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e'
     )  # noqa: E501
     node = HDKey.from_pubkey(pk)
     self.assertEqual(node.pubkey, pk)