Beispiel #1
0
    def test_generate_g1_key_with_seed(self):
        seed = 'just a seed'
        key_pair = BlsKeyPair.generate_g1(seed)
        self.assertIsNotNone(key_pair, "Key pair should not be None")
        self.assertIsNotNone(key_pair.public_key,
                             "Key pair should have public key")
        self.assertIsNotNone(key_pair.secret_key,
                             "Key pair should have secret key")
        self.assertTrue(key_pair.is_g1, "Key should be G1 key")
        self.assertFalse(key_pair.is_g2, "Key should NOT be G2 key")

        self.assertEqual(BlsKeyPair.secret_key_size(),
                         len(key_pair.secret_key))
        self.assertEqual(BlsKeyPair.public_g1_key_size(),
                         len(key_pair.public_key))

        self.assertEqual(BlsKeyPair.secret_key_size(),
                         len(key_pair.secret_key))
        self.assertEqual(BlsKeyPair.public_g1_key_size(),
                         len(key_pair.public_key))
Beispiel #2
0
 def test_get_secret_key_size(self):
     self.assertEqual(BlsKeyPair.secret_key_size(), 32,
                      "Secret key should be of length 32")