MCPcopy Create free account
hub / github.com/Apress/practical-cryptography-in-python / FakeOracle

Class FakeOracle

src/rsa_oracle_attack.py:48–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47# RSA Oracle Attack Component
48class FakeOracle:
49 def __init__(self, private_key):
50 self.private_key = private_key
51
52 def __call__(self, cipher_text):
53 recovered_as_int = simple_rsa_decrypt(cipher_text, self.private_key)
54 recovered = int_to_bytes(recovered_as_int, self.private_key.key_size//8)
55 return recovered[0:2] == bytes([0, 2])
56
57class RSAOracleAttacker:
58 def __init__(self, public_key, oracle):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected