diff --git a/src/regps/app/api/digest_verifier.py b/src/regps/app/api/digest_verifier.py index a3e0a8c..03b7195 100644 --- a/src/regps/app/api/digest_verifier.py +++ b/src/regps/app/api/digest_verifier.py @@ -4,7 +4,7 @@ def get_non_prefixed_digest(dig): try: - prefix, digest = dig.split("_", 1) + prefix, digest = dig.split("-", 1) except ValueError: raise DigestVerificationFailedException( f"Digest ({dig}) must start with prefix", 400 diff --git a/tests/unit/test_reports_db.py b/tests/unit/test_reports_db.py index 238f41d..dd55f27 100644 --- a/tests/unit/test_reports_db.py +++ b/tests/unit/test_reports_db.py @@ -5,9 +5,9 @@ def test_check_report_status_authorization(): aid = "jnhh8f7h79nufb97hbw3fieBHJBgg7uhn" lei = "j9h7ufehhcWBUTDVWYH98h9bfyaebgGBFfsa3wFf" report_1 = "report 1" - dig_1 = "sha256_moiuhLFBf9afnHJDfaffg4ehgh" + dig_1 = "sha256-moiuhLFBf9afnHJDfaffg4ehgh" report_2 = "report 2" - dig_2 = "sha256_fer4grniuojnfaNHBBcaaUh89h" + dig_2 = "sha256-fer4grniuojnfaNHBBcaaUh89h" reports_db = ReportsDB() reports_db.register_aid(aid, lei) reports_db.add_report(aid, dig_1, report_1) @@ -23,9 +23,9 @@ def test_check_report_status_authorization_2_aids_from_the_same_lei(): aid_2 = "UNBOUb8dadh98hnansudHD0jndbuh8hnd" lei = "j9h7ufehhcWBUTDVWYH98h9bfyaebgGBFfsa3wFf" report_1 = "report 1" - dig_1 = "sha256_moiuhLFBf9afnHJDfaffg4ehgh" + dig_1 = "sha256-moiuhLFBf9afnHJDfaffg4ehgh" report_2 = "report 2" - dig_2 = "sha256_fer4grniuojnfaNHBBcaaUh89h" + dig_2 = "sha256-fer4grniuojnfaNHBBcaaUh89h" reports_db = ReportsDB() reports_db.register_aid(aid_1, lei) reports_db.register_aid(aid_2, lei) @@ -47,9 +47,9 @@ def test_check_report_status_authorization_2_aids_from_different_lei(): lei_1 = "j9h7ufehhcWBUTDVWYH98h9bfyaebgGBFfsa3wFf" lei_2 = "mOI8hbsah80hihSHFIHh8h3r8hf8h08hfaiffha0" report_1 = "report 1" - dig_1 = "sha256_moiuhLFBf9afnHJDfaffg4ehgh" + dig_1 = "sha256-moiuhLFBf9afnHJDfaffg4ehgh" report_2 = "report 2" - dig_2 = "sha256_fer4grniuojnfaNHBBcaaUh89h" + dig_2 = "sha256-fer4grniuojnfaNHBBcaaUh89h" reports_db = ReportsDB() reports_db.register_aid(aid_1, lei_1) reports_db.register_aid(aid_2, lei_2) diff --git a/tests/unit/test_verifying.py b/tests/unit/test_verifying.py index 2054268..1077a89 100644 --- a/tests/unit/test_verifying.py +++ b/tests/unit/test_verifying.py @@ -11,7 +11,7 @@ def test_digest_verification(): BASE_STR = "fefUBIUhdo9032bfHf0UNONF0kubni9HnF22L0KD2".encode() dig = sha256(BASE_STR).hexdigest() - dig = f"sha256_{dig}" + dig = f"sha256-{dig}" assert verify_digest(BASE_STR, dig) is True @@ -19,7 +19,7 @@ def test_digest_verification_fail(): BASE_STR = "fefUBIUhdo9032bfHf0UNONF0kubni9HnF22L0KD2".encode() WRONG_BASE_STR = "fefUBIUhdo9032bfHf0UNONF0kubni9HnF22L0KDT".encode() dig = sha256(BASE_STR).hexdigest() - dig = f"sha256_{dig}" + dig = f"sha256-{dig}" assert verify_digest(WRONG_BASE_STR, dig) is False