def setupKeys(self, base_key): self.key = base_key self.pykey = crypto.PythonRSAKey( private_key_string=self.key.get_private_key_string(), ) if crypto.M2CRYPTO_EXISTS: self.m2cryptokey = crypto.M2CryptoKey( private_key_string=self.key.get_private_key_string(), public_key_string=self.key.get_public_key_string() ) if crypto.CRYPTOGRAPHY_EXISTS: self.cryptokey = crypto.CryptographyKey( private_key_string=self.key.get_private_key_string(), public_key_string=self.key.get_public_key_string() ) self.message_actual = "Hello world! Please leave a message after the tone." self.message_fake = "Hello world! Please leave a message after the tone..."
def setUp(self): self.setupKeys(crypto.CryptographyKey())
def test_pubkey_verification_crypto(self): pubkey = crypto.CryptographyKey(public_key_string=self.key.get_public_key_string()) sig = self.key.sign(self.message_actual) self.assertTrue(pubkey.verify(self.message_actual, sig)) self.assertFalse(pubkey.verify(self.message_fake, sig))
def setUp(self): self.key = crypto.CryptographyKey(private_key_string=self.priv_key_string)