Skip to content

Commit

Permalink
Merge pull request #1324 from andrewwhitehead/fix/get_pack_recip
Browse files Browse the repository at this point in the history
Handle unpadded protected header in PackWireFormat::get_recipient_keys
  • Loading branch information
andrewwhitehead authored Jul 19, 2021
2 parents a58d7ba + b82780f commit 9e786f3
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 9e786f3

Please sign in to comment.