Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Mollard committed Apr 4, 2024
1 parent fed8c42 commit 95be79f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions jwcrypto/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,18 @@ def test_decrypt_keyset(self):
with self.assertRaises(JWKeyNotFound):
e4.deserialize(e3.serialize(), ks)

def test_serialize_not_flattened(self):
# JWE with flattened=False adds recipients in objects and in serialized
e = jwe.JWE(E_A1_ex['plaintext'], flattened=False)
e.add_recipient(E_A1_ex['key'], E_A1_ex['protected'])
self.assertIn('recipients', e.objects)
self.assertIn('recipients', e.serialize())

e = jwe.JWE(E_A1_ex['plaintext'])
e.add_recipient(E_A1_ex['key'], E_A1_ex['protected'])
self.assertNotIn('recipients', e.objects)
self.assertNotIn('recipients', e.serialize())


MMA_vector_key = jwk.JWK(**E_A2_key)
MMA_vector_ok_cek = \
Expand Down

0 comments on commit 95be79f

Please sign in to comment.