def test_encrypt(self): encrypter = Encrypter() encrypted_data = encrypter.encrypt(SUBMISSION_DATA) decrypter = Decrypter() unencrypted_data = decrypter.decrypt(encrypted_data) self.assertEquals(SUBMISSION_DATA["type"], unencrypted_data["type"]) self.assertEquals(SUBMISSION_DATA["version"], unencrypted_data["version"]) self.assertEquals(SUBMISSION_DATA["origin"], unencrypted_data["origin"]) self.assertEquals(SUBMISSION_DATA["survey_id"], unencrypted_data["survey_id"]) self.assertEquals(SUBMISSION_DATA["collection"], unencrypted_data["collection"]) self.assertEquals(SUBMISSION_DATA["metadata"], unencrypted_data["metadata"]) self.assertEquals(SUBMISSION_DATA["paradata"], unencrypted_data["paradata"]) self.assertEquals(SUBMISSION_DATA["data"], unencrypted_data["data"])
def test_encrypt(self): encrypter = Encrypter() encrypted_data = encrypter.encrypt(SUBMISSION_DATA) decrypter = Decrypter() unencrypted_data = decrypter.decrypt(encrypted_data) self.assertEqual(SUBMISSION_DATA["type"], unencrypted_data["type"]) self.assertEqual(SUBMISSION_DATA["version"], unencrypted_data["version"]) self.assertEqual(SUBMISSION_DATA["origin"], unencrypted_data["origin"]) self.assertEqual(SUBMISSION_DATA["survey_id"], unencrypted_data["survey_id"]) self.assertEqual(SUBMISSION_DATA["collection"], unencrypted_data["collection"]) self.assertEqual(SUBMISSION_DATA["metadata"], unencrypted_data["metadata"]) self.assertEqual(SUBMISSION_DATA["paradata"], unencrypted_data["paradata"]) self.assertEqual(SUBMISSION_DATA["data"], unencrypted_data["data"])
def test_encrypt(self): encrypter = Encrypter(TEST_DO_NOT_USE_SR_PRIVATE_SIGNING_KEY, TEST_DO_NOT_USE_SR_PRIVATE_SIGNING_KEY_PASSWORD, TEST_DO_NOT_USE_EQ_SUBMISSION_SDX_PUBLIC_KEY) encrypted_data = encrypter.encrypt(SUBMISSION_DATA) decrypter = Decrypter() unencrypted_data = decrypter.decrypt(encrypted_data) self.assertEqual(SUBMISSION_DATA["type"], unencrypted_data["type"]) self.assertEqual(SUBMISSION_DATA["version"], unencrypted_data["version"]) self.assertEqual(SUBMISSION_DATA["origin"], unencrypted_data["origin"]) self.assertEqual(SUBMISSION_DATA["survey_id"], unencrypted_data["survey_id"]) self.assertEqual(SUBMISSION_DATA["collection"], unencrypted_data["collection"]) self.assertEqual(SUBMISSION_DATA["metadata"], unencrypted_data["metadata"]) self.assertEqual(SUBMISSION_DATA["paradata"], unencrypted_data["paradata"]) self.assertEqual(SUBMISSION_DATA["data"], unencrypted_data["data"])
def encrypt_message(self, message): encrypter = Encrypter() encrypted_message = encrypter.encrypt(message) return encrypted_message