Skip to content

Commit 9c513e6

Browse files
authored
Refactor COSE.
Refactor COSE.
2 parents afcc7e4 + d0830b6 commit 9c513e6

8 files changed

Lines changed: 282 additions & 153 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ enc_key = COSEKey.generate_symmetric_key(alg="ChaCha20/Poly1305", kid="01")
362362
# The sender side:
363363
nonce = enc_key.generate_nonce()
364364
sender = COSE.new(alg_auto_inclusion=True, kid_auto_inclusion=True)
365-
encoded = sender.encode_and_encrypt(b"Hello world!", enc_key, nonce=nonce)
365+
encoded = sender.encode_and_encrypt(b"Hello world!", enc_key, unprotected={"iv": nonce})
366366

367367
# The recipient side:
368368
recipient = COSE.new()
@@ -445,7 +445,7 @@ sender = COSE.new()
445445
encoded = sender.encode_and_encrypt(
446446
b"Hello world!",
447447
enc_key,
448-
nonce=nonce,
448+
unprotected={5: nonce},
449449
recipients=[r],
450450
)
451451

@@ -606,7 +606,7 @@ sender = COSE.new(alg_auto_inclusion=True)
606606
encoded = sender.encode_and_encrypt(
607607
b"Hello world!",
608608
key=enc_key,
609-
nonce=nonce,
609+
unprotected={5: nonce},
610610
recipients=[r],
611611
)
612612

0 commit comments

Comments
 (0)