def testVerifySig(self): keys_auth = EllipticalKeysAuth(self.path) rs = BaseResourceServer(TestResourceManager(self.dir_manager), self.dir_manager, keys_auth, MockClient()) test_str = "A test string to sign" sig = rs.sign(test_str) self.assertTrue(rs.verify_sig(sig, test_str, keys_auth.get_public_key()))
def testDecrypt(self): keys_auth = EllipticalKeysAuth(self.path) client = MockClient() rs = BaseResourceServer(TestResourceManager(self.dir_manager), self.dir_manager, keys_auth, client) to_encrypt = "test string to enc" encrypted = rs.encrypt(to_encrypt, keys_auth.get_public_key()) decrypted = rs.decrypt(encrypted) self.assertEqual(decrypted, to_encrypt)