Skip to content

Commit 74d2e76

Browse files
committed
Merge branch 'main' into fix-generate-zero-length-protected-header-for-non-aead
2 parents 15ba26f + 10f7efc commit 74d2e76

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cwt/cose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def _encode_and_encrypt(
738738
b_key = key.to_bytes() if isinstance(key, COSEKeyInterface) else b""
739739
cek: Optional[COSEKeyInterface] = None
740740
for rec in recipients:
741-
aad = self._dumps(["Enc_Recipient", self._dumps(rec.protected), external_aad])
741+
aad = self._dumps(["Enc_Recipient", self._dumps(rec.protected) if len(rec.protected) > 0 else b"", external_aad])
742742
encoded, derived_key = rec.encode(b_key, aad)
743743
cek = derived_key if derived_key else key
744744
recs.append(encoded)

0 commit comments

Comments
 (0)