diff --git a/data/full_doc_ext/bbox-ballotbox-key-cp.json b/data/full_doc_ext/BBox-ballotbox-key-CP.json similarity index 100% rename from data/full_doc_ext/bbox-ballotbox-key-cp.json rename to data/full_doc_ext/BBox-ballotbox-key-CP.json diff --git a/data/language_change/bbox-ballotbox-key-cp.json b/data/language_change/BBox-ballotbox-key-CP.json similarity index 100% rename from data/language_change/bbox-ballotbox-key-cp.json rename to data/language_change/BBox-ballotbox-key-CP.json diff --git a/environment.yml b/environment.yml index 231e66e..255aa96 100644 --- a/environment.yml +++ b/environment.yml @@ -10,6 +10,6 @@ dependencies: - gmpy2 - pyqt5 - python-gnupg - - PyPDF2 + - pypdf - argparse diff --git a/requirements.txt b/requirements.txt index e9e76d2..c4c58ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ pycryptodome gmpy2 pyqt5 python-gnupg -PyPDF2 +pypdf argparse diff --git a/src/polyas_checker.py b/src/polyas_checker.py index 140ee9e..db6c22b 100644 --- a/src/polyas_checker.py +++ b/src/polyas_checker.py @@ -3,7 +3,7 @@ # Copyright © 2019-2023, Karlsruhe Institute of Technology (KIT), Maximilian Noppel, Christoph Niederbudde import logging -import PyPDF2 +import pypdf import argparse import hashlib import json @@ -624,9 +624,9 @@ def verify_second_device_public_parameters(path, phase1=None): keygen = load_key_gen_election_key(path) verificationKey = "" try: - verificationKey = loadSecureJSON(path, "bbox-ballotbox-key-cp.json", sequence=False) + verificationKey = loadSecureJSON(path, "BBox-ballotbox-key-CP.json", sequence=False) except Exception: - logger.info("No file with verification key found: bbox-ballotbox-key-cp.json") + logger.info("No file with verification key found: BBox-ballotbox-key-CP.json") if phase1: phase1.setValue(100) phase1.setStyleSheet(redStyle) @@ -682,7 +682,7 @@ def get_signature_if_valid(receiptPath: str, file: str, key: str, logTo=None): Returns fingerprint if the file is valid, else None """ f = open(os.path.join(receiptPath, file), 'rb') - reader = PyPDF2.PdfReader(f) + reader = pypdf.PdfReader(f) receipt = reader.pages[0].extract_text().replace("\n", "") f.close() fingerprintList = re.findall(r".*BEGIN FINGERPRINT----- ?([0-9|a-f]*) ?-----END FINGERPRINT.*", receipt) @@ -706,11 +706,11 @@ def verify_receipts(path, phase1=None, log=False, logTo=None): verificationKey = None receiptPath = os.path.join(path, "receipts") try: - verificationKey = loadSecureJSON(path, "bbox-ballotbox-key-cp.json", sequence=False) + verificationKey = loadSecureJSON(path, "BBox-ballotbox-key-CP.json", sequence=False) if phase1: phase1.setValue(25) except Exception: - logger.info("No file with verification key found: bbox-ballotbox-key-cp.json") + logger.info("No file with verification key found: BBox-ballotbox-key-CP.json") if phase1: phase1.setValue(100) phase1.setStyleSheet(redStyle) diff --git a/src/test/integrationtests.py b/src/test/integrationtests.py index 17d8566..a311faf 100644 --- a/src/test/integrationtests.py +++ b/src/test/integrationtests.py @@ -101,13 +101,13 @@ def testValidFingerprint(self): def testValidReceipt(self): path = "../data/full_doc_ext" - key = loadSecureJSON(path, "bbox-ballotbox-key-cp.json") + key = loadSecureJSON(path, "BBox-ballotbox-key-CP.json") gpg = initialize_gpg([key]) self.assertNotEqual(get_signature_if_valid(path + "/receipts", "b1.pdf", gpg, key), None) def testInvalidReceipt(self): path = "../data/full_doc_ext" - key = loadSecureJSON(path, "bbox-ballotbox-key-cp.json") + key = loadSecureJSON(path, "BBox-ballotbox-key-CP.json") gpg = initialize_gpg([key]) self.assertEqual(get_signature_if_valid(path + "/receipts", "b2.pdf", gpg, key), None)