Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unpadded protected header in PackWireFormat::get_recipient_keys #1324

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aries_cloudagent/transport/pack_format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Standard packed message format classes."""

from base64 import b64decode
import json
import logging
from typing import List, Sequence, Tuple, Union
Expand All @@ -13,6 +12,7 @@
from ..utils.task_queue import TaskQueue
from ..wallet.base import BaseWallet
from ..wallet.error import WalletError
from ..wallet.util import b64_to_str

from .error import WireFormatParseError, WireFormatEncodeError, RecipientKeysError
from .inbound.receipt import MessageReceipt
Expand Down Expand Up @@ -211,7 +211,7 @@ def get_recipient_keys(self, message_body: Union[str, bytes]) -> List[str]:

try:
message_dict = json.loads(message_body)
protected = json.loads(b64decode(message_dict["protected"]))
protected = json.loads(b64_to_str(message_dict["protected"], urlsafe=True))
recipients = protected["recipients"]

recipient_keys = [recipient["header"]["kid"] for recipient in recipients]
Expand Down