From b82780f5c00675479b5543e46aa20115ac9347bd Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Fri, 16 Jul 2021 12:17:51 -0700 Subject: [PATCH] handle unpadded protected header Signed-off-by: Andrew Whitehead --- aries_cloudagent/transport/pack_format.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/transport/pack_format.py b/aries_cloudagent/transport/pack_format.py index 355bcae23b..9c3ad8300f 100644 --- a/aries_cloudagent/transport/pack_format.py +++ b/aries_cloudagent/transport/pack_format.py @@ -1,6 +1,5 @@ """Standard packed message format classes.""" -from base64 import b64decode import json import logging from typing import List, Sequence, Tuple, Union @@ -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 @@ -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]