Exemple #1
0
    def test_serialize_deserialize_private_key(self, priv_key, pub_key, data):
        serialized = priv_key.to_bytes()
        deserialized_priv_key = SqueakPrivateKey.from_bytes(serialized)

        assert deserialized_priv_key == priv_key

        signature = deserialized_priv_key.sign(data)

        assert len(serialized) == PRIV_KEY_LENGTH
        assert pub_key.verify(data, signature)
Exemple #2
0
    def test_deserialize_invalid_private_key(self):
        invalid_private_key_bytes = b""

        with pytest.raises(InvalidPrivateKeyError):
            SqueakPrivateKey.from_bytes(invalid_private_key_bytes)