Skip to content

Commit

Permalink
#60 and also making #62 available on the partner
Browse files Browse the repository at this point in the history
  • Loading branch information
chadgates committed Mar 20, 2024
1 parent e362211 commit cbf0659
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pyas2lib/as2.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ class Partner:
:param canonicalize_as_binary: force binary canonicalization for this partner
:param sign_alg: The signing algorithm to be used for generating the
signature. (default `rsassa_pkcs1v15`)
:param key_enc_alg: The key encryption algorithm to be used.
(default `rsaes_pkcs1v15`)
"""

as2_name: str
Expand All @@ -200,6 +206,8 @@ class Partner:
mdn_confirm_text: str = MDN_CONFIRM_TEXT
ignore_self_signed: bool = True
canonicalize_as_binary: bool = False
sign_alg: str = "rsassa_pkcs1v15"
key_enc_alg: str = "rsaes_pkcs1v15"

def __post_init__(self):
"""Run the post initialisation checks for this class."""
Expand Down Expand Up @@ -469,7 +477,10 @@ def build(
)
del signature["MIME-Version"]
signature_data = sign_message(
mic_content, self.digest_alg, self.sender.sign_key
mic_content,
self.digest_alg,
self.sender.sign_key,
self.receiver.sign_alg,
)
signature.set_payload(signature_data)
encoders.encode_base64(signature)
Expand Down Expand Up @@ -930,7 +941,10 @@ def build(
del signature["MIME-Version"]

signed_data = sign_message(
canonicalize(self.payload), self.digest_alg, message.receiver.sign_key
canonicalize(self.payload),
self.digest_alg,
message.receiver.sign_key,
message.sender.sign_alg,
)
signature.set_payload(signed_data)
encoders.encode_base64(signature)
Expand Down

0 comments on commit cbf0659

Please sign in to comment.