|
22 | 22 | import logging
|
23 | 23 | from datetime import datetime, timezone
|
24 | 24 | from typing import cast
|
| 25 | +import json |
25 | 26 |
|
26 | 27 | import rekor_types
|
27 | 28 | from cryptography.exceptions import InvalidSignature
|
@@ -432,7 +433,19 @@ def verify_dsse(
|
432 | 433 | and entry._kind_version.version == "0.0.2"
|
433 | 434 | ):
|
434 | 435 | try:
|
435 |
| - entry_body = v2.Entry().from_json(base64.b64decode(entry.body)) |
| 436 | + # entry_body = v2.Entry().from_json(base64.b64decode(entry.body)) |
| 437 | + # A potential issue with the returned body not parsing properly. |
| 438 | + # perhaps the json_name in the protos. |
| 439 | + _dict = json.loads(base64.b64decode(entry.body)) |
| 440 | + actual_body = v2.Entry( |
| 441 | + kind=_dict['kind'], |
| 442 | + api_version=_dict['apiVersion'], |
| 443 | + spec=v2.Spec( |
| 444 | + hashed_rekord_v0_0_2=v2.HashedRekordLogEntryV002.from_dict( |
| 445 | + _dict['spec']['dsseV002'] |
| 446 | + ) |
| 447 | + ) |
| 448 | + ) |
436 | 449 | except ValidationError as exc:
|
437 | 450 | raise VerificationError(f"invalid DSSE log entry: {exc}")
|
438 | 451 |
|
@@ -546,7 +559,19 @@ def verify_artifact(
|
546 | 559 | entry._kind_version.kind == "hashedrekord"
|
547 | 560 | and entry._kind_version.version == "0.0.2"
|
548 | 561 | ):
|
549 |
| - actual_body = v2.Entry().from_json(base64.b64decode(entry.body)) |
| 562 | + _dict = json.loads(base64.b64decode(entry.body)) |
| 563 | + print(_dict) |
| 564 | + # A potential issue with the returned body not parsing properly. |
| 565 | + # perhaps the json_name in the protos. |
| 566 | + actual_body = v2.Entry( |
| 567 | + kind=_dict['kind'], |
| 568 | + api_version=_dict['apiVersion'], |
| 569 | + spec=v2.Spec( |
| 570 | + hashed_rekord_v0_0_2=v2.HashedRekordLogEntryV002.from_dict( |
| 571 | + _dict['spec']['hashedRekordV002'] |
| 572 | + ) |
| 573 | + ) |
| 574 | + ) |
550 | 575 | expected_body = v2.Entry(
|
551 | 576 | kind=entry._kind_version.kind,
|
552 | 577 | api_version=entry._kind_version.version,
|
|
0 commit comments