Skip to content

Commit

Permalink
fix p2p encrypt/decrypt (#2251)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanchengnv authored Dec 31, 2023
1 parent ff4ae8f commit e39105b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nvflare/fuel/f3/cellnet/core_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ def encrypt_payload(self, message: Message):
payload_len = len(message.payload)
message.add_headers(
{
MessageHeaderKey.PAYLOAD_LEN: payload_len,
MessageHeaderKey.CLEAR_PAYLOAD_LEN: payload_len,
MessageHeaderKey.ENCRYPTED: True,
}
)
Expand All @@ -968,7 +968,7 @@ def decrypt_payload(self, message: Message):
if not origin:
raise RuntimeError("Message origin missing")

payload_len = message.get_header(MessageHeaderKey.PAYLOAD_LEN)
payload_len = message.get_header(MessageHeaderKey.CLEAR_PAYLOAD_LEN)
origin_cert = self.cert_ex.get_certificate(origin)
message.payload = self.credential_manager.decrypt(origin_cert, message.payload)
if len(message.payload) != payload_len:
Expand Down
1 change: 1 addition & 0 deletions nvflare/fuel/f3/cellnet/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class MessageHeaderKey:
RETURN_REASON = CELLNET_PREFIX + "return_reason"
SECURE = CELLNET_PREFIX + "secure"
PAYLOAD_LEN = CELLNET_PREFIX + "payload_len"
CLEAR_PAYLOAD_LEN = CELLNET_PREFIX + "clear_payload_len"
ENCRYPTED = CELLNET_PREFIX + "encrypted"
OPTIONAL = CELLNET_PREFIX + "optional"

Expand Down

0 comments on commit e39105b

Please sign in to comment.