MCPcopy
hub / github.com/pyca/cryptography / test_public_key_equality

Method test_public_key_equality

tests/hazmat/primitives/test_dsa.py:388–400  ·  view source on GitHub ↗
(self, backend)

Source from the content-addressed store, hash-verified

386 ).private_key(backend)
387
388 def test_public_key_equality(self, backend):
389 key_bytes = load_vectors_from_file(
390 os.path.join("asymmetric", "PKCS8", "unenc-dsa-pkcs8.pem"),
391 lambda pemfile: pemfile.read().encode(),
392 )
393 key1 = serialization.load_pem_private_key(key_bytes, None).public_key()
394 key2 = serialization.load_pem_private_key(key_bytes, None).public_key()
395 key3 = DSA_KEY_2048.private_key().public_key()
396 assert key1 == key2
397 assert key1 != key3
398 assert key1 != object()
399 with pytest.raises(TypeError):
400 key1 < key2 # type: ignore[operator]
401
402 def test_public_key_copy(self):
403 key_bytes = load_vectors_from_file(

Callers

nothing calls this directly

Calls 2

load_vectors_from_fileFunction · 0.85
public_keyMethod · 0.45

Tested by

no test coverage detected